mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-10 15:14:33 +08:00
split custom types in multiple files
This commit is contained in:
parent
3558e20454
commit
0a46d50e4b
7 changed files with 50 additions and 44 deletions
|
@ -3,14 +3,15 @@
|
||||||
import React, { Component } from "react";
|
import React, { Component } from "react";
|
||||||
import { Modal, Button, Alert, Glyphicon } from "react-bootstrap";
|
import { Modal, Button, Alert, Glyphicon } from "react-bootstrap";
|
||||||
import { FormattedMessage, FormattedHTMLMessage } from "react-intl";
|
import { FormattedMessage, FormattedHTMLMessage } from "react-intl";
|
||||||
|
import type { Team$TeamMemeber } from "flow-typed";
|
||||||
import { removeUserFromTeam } from "../../../../../services/api/user_team_api";
|
import { removeUserFromTeam } from "../../../../../services/api/user_team_api";
|
||||||
import type { TeamMemeber } from "../"
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
showModal: boolean,
|
showModal: boolean,
|
||||||
hideModal: Function,
|
hideModal: Function,
|
||||||
updateUsersCallback: Function,
|
updateUsersCallback: Function,
|
||||||
userToRemove: TeamMemeber
|
userToRemove: Team$TeamMemeber
|
||||||
};
|
};
|
||||||
|
|
||||||
class RemoveUserModal extends Component<Props> {
|
class RemoveUserModal extends Component<Props> {
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { LinkContainer } from "react-router-bootstrap";
|
||||||
import { FormattedHTMLMessage, FormattedMessage } from "react-intl";
|
import { FormattedHTMLMessage, FormattedMessage } from "react-intl";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import type { Match } from "react-router-dom";
|
import type { Match } from "react-router-dom";
|
||||||
import type { Team } from "flow-typed";
|
import type { Teams$Team, Team$TeamMemeber } from "flow-typed";
|
||||||
|
|
||||||
import { formatBytes } from "../../../../services/helpers/units_converter_helper";
|
import { formatBytes } from "../../../../services/helpers/units_converter_helper";
|
||||||
import { getTeamDetails } from "../../../../services/api/teams_api";
|
import { getTeamDetails } from "../../../../services/api/teams_api";
|
||||||
|
@ -19,13 +19,6 @@ import TeamsMembers from "./components/TeamsMembers";
|
||||||
import UpdateTeamDescriptionModal from "./components/UpdateTeamDescriptionModal";
|
import UpdateTeamDescriptionModal from "./components/UpdateTeamDescriptionModal";
|
||||||
import UpdateTeamNameModal from "./components/UpdateTeamNameModal";
|
import UpdateTeamNameModal from "./components/UpdateTeamNameModal";
|
||||||
|
|
||||||
export type TeamMemeber = {
|
|
||||||
userName: string,
|
|
||||||
team_user_id: number,
|
|
||||||
teamName: string,
|
|
||||||
team_id: number
|
|
||||||
};
|
|
||||||
|
|
||||||
const Wrapper = styled.div`
|
const Wrapper = styled.div`
|
||||||
background: white;
|
background: white;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
@ -80,8 +73,8 @@ type Props = {
|
||||||
type State = {
|
type State = {
|
||||||
showDescriptionModal: boolean,
|
showDescriptionModal: boolean,
|
||||||
showNameModal: boolean,
|
showNameModal: boolean,
|
||||||
users: Array<TeamMember>,
|
users: Array<Team$TeamMemeber>,
|
||||||
team: Team
|
team: Teams$Team
|
||||||
};
|
};
|
||||||
|
|
||||||
class SettingsTeam extends Component<Props, State> {
|
class SettingsTeam extends Component<Props, State> {
|
||||||
|
@ -139,11 +132,11 @@ class SettingsTeam extends Component<Props, State> {
|
||||||
(this: any).setState({ showNameModal: false });
|
(this: any).setState({ showNameModal: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
updateTeamCallback(team: Team): void {
|
updateTeamCallback(team: Teams$Team): void {
|
||||||
(this: any).setState({ team });
|
(this: any).setState({ team });
|
||||||
}
|
}
|
||||||
|
|
||||||
updateUsersCallback(users: Array<TeamMember>): void {
|
updateUsersCallback(users: Array<Team$TeamMemeber>): void {
|
||||||
(this: any).setState({ users });
|
(this: any).setState({ users });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ const Wrapper = styled.div`
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
tabState: Function,
|
tabState: Function,
|
||||||
teams: Array<Team>
|
teams: Array<Teams$Team>
|
||||||
}
|
}
|
||||||
|
|
||||||
class SettingsTeams extends Component<Props> {
|
class SettingsTeams extends Component<Props> {
|
||||||
|
|
|
@ -16,7 +16,7 @@ import { FormattedMessage } from "react-intl";
|
||||||
import update from "immutability-helper";
|
import update from "immutability-helper";
|
||||||
import styled from "styled-components";
|
import styled from "styled-components";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import type { NewTeam } from "flow-typed";
|
import type { Teams$NewTeam } from "flow-typed";
|
||||||
import { createNewTeam } from "../../../../../services/api/teams_api";
|
import { createNewTeam } from "../../../../../services/api/teams_api";
|
||||||
import {
|
import {
|
||||||
SETTINGS_TEAMS_ROUTE,
|
SETTINGS_TEAMS_ROUTE,
|
||||||
|
@ -48,7 +48,8 @@ const MyFormGroupDiv = styled.div`
|
||||||
`;
|
`;
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
tabState: Function
|
tabState: Function,
|
||||||
|
getTeamsList: Function
|
||||||
};
|
};
|
||||||
|
|
||||||
type FormErrors = {
|
type FormErrors = {
|
||||||
|
@ -57,7 +58,7 @@ type FormErrors = {
|
||||||
};
|
};
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
team: NewTeam,
|
team: Teams$NewTeam,
|
||||||
formErrors: FormErrors,
|
formErrors: FormErrors,
|
||||||
redirectTo: string
|
redirectTo: string
|
||||||
};
|
};
|
||||||
|
|
8
flow-typed/team_types.js
vendored
Normal file
8
flow-typed/team_types.js
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
// @flow
|
||||||
|
|
||||||
|
export type Team$TeamMemeber = {
|
||||||
|
userName: string,
|
||||||
|
team_user_id: number,
|
||||||
|
teamName: string,
|
||||||
|
team_id: number
|
||||||
|
};
|
26
flow-typed/teams_types.js
vendored
Normal file
26
flow-typed/teams_types.js
vendored
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
// @flow
|
||||||
|
|
||||||
|
export type Teams$TeamMember = {
|
||||||
|
actions: { current_role: string, team_user_id: number, disable: boolean },
|
||||||
|
created_at: string,
|
||||||
|
email: string,
|
||||||
|
id: number,
|
||||||
|
name: string,
|
||||||
|
role: string,
|
||||||
|
status: string
|
||||||
|
};
|
||||||
|
|
||||||
|
export type Teams$NewTeam = {
|
||||||
|
name: string,
|
||||||
|
description: string
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
export type Teams$Team = {
|
||||||
|
id: number,
|
||||||
|
name: string,
|
||||||
|
current_team: boolean,
|
||||||
|
role: string,
|
||||||
|
members: number,
|
||||||
|
can_be_leaved: boolean
|
||||||
|
};
|
29
flow-typed/types.js
vendored
29
flow-typed/types.js
vendored
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
import type { Teams$Team } from "flow-typed";
|
||||||
|
|
||||||
export type User = {
|
export type User = {
|
||||||
id: number,
|
id: number,
|
||||||
|
@ -8,21 +9,6 @@ export type User = {
|
||||||
avatarThumb: string
|
avatarThumb: string
|
||||||
};
|
};
|
||||||
|
|
||||||
export type TeamMember = {
|
|
||||||
actions: { current_role: string, team_user_id: number, disable: boolean },
|
|
||||||
created_at: string,
|
|
||||||
email: string,
|
|
||||||
id: number,
|
|
||||||
name: string,
|
|
||||||
role: string,
|
|
||||||
status: string
|
|
||||||
};
|
|
||||||
|
|
||||||
export type NewTeam = {
|
|
||||||
name: string,
|
|
||||||
description: string
|
|
||||||
};
|
|
||||||
|
|
||||||
export type Alert = {
|
export type Alert = {
|
||||||
message: string,
|
message: string,
|
||||||
type: string,
|
type: string,
|
||||||
|
@ -36,18 +22,9 @@ export type Activity = {
|
||||||
created_at: string
|
created_at: string
|
||||||
};
|
};
|
||||||
|
|
||||||
export type Team = {
|
|
||||||
id: number,
|
|
||||||
name: string,
|
|
||||||
current_team: boolean,
|
|
||||||
role: string,
|
|
||||||
members: number,
|
|
||||||
can_be_leaved: boolean
|
|
||||||
};
|
|
||||||
|
|
||||||
export type State = {
|
export type State = {
|
||||||
current_team: Team,
|
current_team: Teams$Team,
|
||||||
all_teams: Array<Team>,
|
all_teams: Array<Teams$Team>,
|
||||||
current_user: User,
|
current_user: User,
|
||||||
showLeaveTeamModal: boolean,
|
showLeaveTeamModal: boolean,
|
||||||
alerts: Alert
|
alerts: Alert
|
||||||
|
|
Loading…
Add table
Reference in a new issue