Skip to content

Commit

Permalink
Remove unused exports and component localization. (#977)
Browse files Browse the repository at this point in the history
  • Loading branch information
imnasnainaec authored Feb 4, 2021
1 parent 48944f3 commit 9d9806e
Show file tree
Hide file tree
Showing 66 changed files with 190 additions and 340 deletions.
2 changes: 1 addition & 1 deletion src/components/AppBar/AppBarComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import NavigationButtons from "components/AppBar/NavigationButtons";
import ProjectNameButton from "components/AppBar/ProjectNameButton";
import UserMenu from "components/AppBar/UserMenu";

export interface AppBarComponentProps {
interface AppBarComponentProps {
currentTab: Path;
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/Buttons/FileInputButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";
import { Button } from "@material-ui/core";
import { ButtonProps } from "@material-ui/core/Button";

export interface BrowseProps {
interface BrowseProps {
updateFile: (file: File) => void;
accept?: string;
children?: React.ReactNode;
Expand Down
4 changes: 2 additions & 2 deletions src/components/ContextMenu/ContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import {

export type MenuType = [string, () => void];

export interface ContextMenuProps {
interface ContextMenuProps {
options: MenuType[];
anchorName: string;
}
export interface ContextMenuState {
interface ContextMenuState {
isOpen: boolean;
}

Expand Down
27 changes: 11 additions & 16 deletions src/components/DataEntry/DataEntryTable/NewEntry/SenseDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,21 @@ import {
withStyles,
} from "@material-ui/core";
import React from "react";
import {
LocalizeContextProps,
Translate,
withLocalize,
} from "react-localize-redux";
import { Translate } from "react-localize-redux";

import theme from "types/theme";
import { Sense, Word } from "types/word";
import DomainCell from "goals/ReviewEntries/ReviewEntriesComponent/CellComponents/DomainCell";
import { parseWord } from "goals/ReviewEntries/ReviewEntriesComponent/ReviewEntriesTypes";
import theme from "types/theme";
import { Sense, Word } from "types/word";

interface SenseDialogProps {
selectedWord: Word;
open: boolean;
handleClose: (senseIndex?: number) => void;
analysisLang: string;
}

function SenseDialog(
props: {
selectedWord: Word;
open: boolean;
handleClose: (senseIndex?: number) => void;
analysisLang: string;
} & LocalizeContextProps
) {
export default function SenseDialog(props: SenseDialogProps) {
return (
<Dialog
open={props.open}
Expand Down Expand Up @@ -100,4 +96,3 @@ export function SenseList(props: SenseListProps) {
</React.Fragment>
);
}
export default withLocalize(SenseDialog);
27 changes: 11 additions & 16 deletions src/components/DataEntry/DataEntryTable/NewEntry/VernDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,22 @@ import {
withStyles,
} from "@material-ui/core";
import React from "react";
import {
LocalizeContextProps,
Translate,
withLocalize,
} from "react-localize-redux";
import { Translate } from "react-localize-redux";

import theme from "types/theme";
import { Word } from "types/word";
import DomainCell from "goals/ReviewEntries/ReviewEntriesComponent/CellComponents/DomainCell";
import SenseCell from "goals/ReviewEntries/ReviewEntriesComponent/CellComponents/SenseCell";
import { parseWord } from "goals/ReviewEntries/ReviewEntriesComponent/ReviewEntriesTypes";
import theme from "types/theme";
import { Word } from "types/word";

interface vernDialogProps {
vernacularWords: Word[];
open: boolean;
handleClose: (selectedWordId?: string) => void;
analysisLang: string;
}

export function VernDialog(
props: {
vernacularWords: Word[];
open: boolean;
handleClose: (selectedWordId?: string) => void;
analysisLang: string;
} & LocalizeContextProps
) {
export default function VernDialog(props: vernDialogProps) {
return (
<Dialog
open={props.open}
Expand Down Expand Up @@ -101,4 +97,3 @@ export function VernList(props: VernListProps) {
</React.Fragment>
);
}
export default withLocalize(VernDialog);
16 changes: 4 additions & 12 deletions src/components/GoalTimeline/GoalDisplay/HorizontalDisplay.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import React from "react";
import {
LocalizeContextProps,
withLocalize,
Translate,
} from "react-localize-redux";
import { Translate } from "react-localize-redux";
import { Typography, GridList, GridListTile, Button } from "@material-ui/core";

import { Goal } from "types/goals";
Expand All @@ -22,20 +18,18 @@ const style = {
},
};

export interface HorizontalDisplayProps {
interface HorizontalDisplayProps {
data: Goal[];
width: number;
numPanes: number;
scrollToEnd: boolean;
handleChange: (name: string) => void;
}

export class HorizontalDisplay extends React.Component<
HorizontalDisplayProps & LocalizeContextProps
> {
export default class HorizontalDisplay extends React.Component<HorizontalDisplayProps> {
optionWidth: number;

constructor(props: HorizontalDisplayProps & LocalizeContextProps) {
constructor(props: HorizontalDisplayProps) {
super(props);

this.optionWidth = this.props.width / 3 - 1;
Expand Down Expand Up @@ -105,5 +99,3 @@ export class HorizontalDisplay extends React.Component<
);
}
}

export default withLocalize(HorizontalDisplay);
21 changes: 8 additions & 13 deletions src/components/GoalTimeline/GoalDisplay/VerticalDisplay.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import React from "react";
import {
LocalizeContextProps,
withLocalize,
Translate,
} from "react-localize-redux";
import { Typography, GridList, GridListTile, Button } from "@material-ui/core";
import React from "react";
import { Translate } from "react-localize-redux";

import { Goal } from "types/goals";

Expand All @@ -22,24 +18,25 @@ const style = {
},
};

export interface VerticalDisplayProps {
interface VerticalDisplayProps {
data: Goal[];
height: number;
numPanes: number;
scrollToEnd: boolean;
handleChange: (name: string) => void;
}
export interface VerticalDisplayStates {

interface VerticalDisplayStates {
scrollVisible: boolean;
}

export class VerticalDisplay extends React.Component<
VerticalDisplayProps & LocalizeContextProps,
export default class VerticalDisplay extends React.Component<
VerticalDisplayProps,
VerticalDisplayStates
> {
optionHeight: number;

constructor(props: VerticalDisplayProps & LocalizeContextProps) {
constructor(props: VerticalDisplayProps) {
super(props);
this.state = { scrollVisible: false };
this.optionHeight = this.props.height / 3 - 1.25;
Expand Down Expand Up @@ -118,5 +115,3 @@ export class VerticalDisplay extends React.Component<
);
}
}

export default withLocalize(VerticalDisplay);
5 changes: 0 additions & 5 deletions src/components/GoalTimeline/GoalHistory/DefaultState.tsx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import React from "react";
import { withLocalize, LocalizeContextProps } from "react-localize-redux";

import BaseGoalSelect from "goals/DefaultGoal/BaseGoalWidget/BaseGoalWidget";
import { Goal } from "types/goals";

export interface GoalHistoryProps {
interface GoalHistoryProps {
history: Goal[];
}

export class GoalHistory extends React.Component<
GoalHistoryProps & LocalizeContextProps
> {
export default class GoalHistory extends React.Component<GoalHistoryProps> {
render() {
return (
<div className="GoalHistory">
Expand All @@ -21,5 +18,3 @@ export class GoalHistory extends React.Component<
);
}
}

export default withLocalize(GoalHistory);
2 changes: 1 addition & 1 deletion src/components/GoalTimeline/GoalHistory/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import GoalHistory from "components/GoalTimeline/GoalHistory/GoalHistoryComponen
import { StoreState } from "types";
import { GoalHistoryState } from "types/goals";

export function mapStateToProps(state: StoreState): GoalHistoryState {
function mapStateToProps(state: StoreState): GoalHistoryState {
return {
history: state.goalsState.historyState.history,
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import React from "react";
import { LocalizeContextProps, withLocalize } from "react-localize-redux";

import BaseGoalSelect from "goals/DefaultGoal/BaseGoalWidget/BaseGoalWidget";
import { Goal } from "types/goals";

export interface GoalSuggestionsProps {
interface GoalSuggestionsProps {
suggestions: Goal[];
}

export class GoalSuggestions extends React.Component<
GoalSuggestionsProps & LocalizeContextProps
> {
export default class GoalSuggestions extends React.Component<GoalSuggestionsProps> {
render() {
return (
<div className="GoalSuggestions">
Expand All @@ -21,5 +18,3 @@ export class GoalSuggestions extends React.Component<
);
}
}

export default withLocalize(GoalSuggestions);
2 changes: 1 addition & 1 deletion src/components/GoalTimeline/GoalSuggestions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import GoalSuggestions from "components/GoalTimeline/GoalSuggestions/GoalSuggest
import { StoreState } from "types";
import { GoalSuggestionsState } from "types/goals";

export function mapStateToProps(state: StoreState): GoalSuggestionsState {
function mapStateToProps(state: StoreState): GoalSuggestionsState {
return {
suggestions: state.goalsState.suggestionsState.suggestions,
};
Expand Down
6 changes: 3 additions & 3 deletions src/components/GoalTimeline/GoalTimelineComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { Button, GridList, GridListTile, Typography } from "@material-ui/core";
import React, { ReactElement } from "react";
import { Translate } from "react-localize-redux";

import { Goal } from "types/goals";
import HorizontalDisplay from "components/GoalTimeline/GoalDisplay/HorizontalDisplay";
import VerticalDisplay from "components/GoalTimeline/GoalDisplay/VerticalDisplay";
import { Goal } from "types/goals";

const timelineStyle = {
centerDisplays: {
Expand All @@ -27,7 +27,7 @@ const timelineStyle = {
},
};

export interface GoalTimelineProps {
interface GoalTimelineProps {
chooseGoal: (goal: Goal) => void;
loadHistory: () => void;

Expand All @@ -36,7 +36,7 @@ export interface GoalTimelineProps {
suggestions: Goal[];
}

export interface GoalTimelineState {
interface GoalTimelineState {
portrait: boolean;
reducedLandScape: boolean;
}
Expand Down
10 changes: 5 additions & 5 deletions src/components/GoalTimeline/index.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import { connect } from "react-redux";

import { StoreState } from "types";
import { StoreStateDispatch } from "types/actions";
import { Goal } from "types/goals";
import GoalTimeline from "components/GoalTimeline/GoalTimelineComponent";
import {
asyncAddGoalToHistory,
asyncGetUserEdits,
} from "components/GoalTimeline/GoalsActions";
import { StoreState } from "types";
import { StoreStateDispatch } from "types/actions";
import { Goal } from "types/goals";

export function mapStateToProps(state: StoreState) {
function mapStateToProps(state: StoreState) {
return {
allPossibleGoals: state.goalsState.allPossibleGoals,
history: state.goalsState.historyState.history,
suggestions: state.goalsState.suggestionsState.suggestions,
};
}

export function mapDispatchToProps(dispatch: StoreStateDispatch) {
function mapDispatchToProps(dispatch: StoreStateDispatch) {
return {
chooseGoal: (goal: Goal) => {
dispatch(asyncAddGoalToHistory(goal));
Expand Down
2 changes: 1 addition & 1 deletion src/components/Login/AuthHeaders.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getCurrentUser } from "backend/localStorage";

export interface AuthHeader {
interface AuthHeader {
authorization?: string;
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/Login/LoginPage/LoginComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export interface LoginStateProps {
loginFailure: boolean | undefined;
}

export interface LoginState {
interface LoginState {
username: string;
password: string;
isVerified: boolean;
Expand Down
8 changes: 3 additions & 5 deletions src/components/Login/LoginPage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { connect } from "react-redux";

import { StoreState } from "types";
import { StoreStateDispatch } from "types/actions";
import {
asyncLogin,
loginReset,
Expand All @@ -11,6 +9,8 @@ import Login, {
LoginDispatchProps,
LoginStateProps,
} from "components/Login/LoginPage/LoginComponent";
import { StoreState } from "types";
import { StoreStateDispatch } from "types/actions";

function mapStateToProps(state: StoreState): LoginStateProps {
return {
Expand All @@ -19,9 +19,7 @@ function mapStateToProps(state: StoreState): LoginStateProps {
};
}

export function mapDispatchToProps(
dispatch: StoreStateDispatch
): LoginDispatchProps {
function mapDispatchToProps(dispatch: StoreStateDispatch): LoginDispatchProps {
return {
login: (username: string, password: string) => {
dispatch(asyncLogin(username, password));
Expand Down
Loading

0 comments on commit 9d9806e

Please sign in to comment.