split custom types in multiple files

This commit is contained in:
zmagod 2017-10-18 16:14:45 +02:00
parent 3558e20454
commit 0a46d50e4b
7 changed files with 50 additions and 44 deletions

View file

@ -3,14 +3,15 @@
import React, { Component } from "react";
import { Modal, Button, Alert, Glyphicon } from "react-bootstrap";
import { FormattedMessage, FormattedHTMLMessage } from "react-intl";
import type { Team$TeamMemeber } from "flow-typed";
import { removeUserFromTeam } from "../../../../../services/api/user_team_api";
import type { TeamMemeber } from "../"
type Props = {
showModal: boolean,
hideModal: Function,
updateUsersCallback: Function,
userToRemove: TeamMemeber
userToRemove: Team$TeamMemeber
};
class RemoveUserModal extends Component<Props> {

View file

@ -7,7 +7,7 @@ import { LinkContainer } from "react-router-bootstrap";
import { FormattedHTMLMessage, FormattedMessage } from "react-intl";
import moment from "moment";
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 { getTeamDetails } from "../../../../services/api/teams_api";
@ -19,13 +19,6 @@ import TeamsMembers from "./components/TeamsMembers";
import UpdateTeamDescriptionModal from "./components/UpdateTeamDescriptionModal";
import UpdateTeamNameModal from "./components/UpdateTeamNameModal";
export type TeamMemeber = {
userName: string,
team_user_id: number,
teamName: string,
team_id: number
};
const Wrapper = styled.div`
background: white;
box-sizing: border-box;
@ -80,8 +73,8 @@ type Props = {
type State = {
showDescriptionModal: boolean,
showNameModal: boolean,
users: Array<TeamMember>,
team: Team
users: Array<Team$TeamMemeber>,
team: Teams$Team
};
class SettingsTeam extends Component<Props, State> {
@ -139,11 +132,11 @@ class SettingsTeam extends Component<Props, State> {
(this: any).setState({ showNameModal: false });
}
updateTeamCallback(team: Team): void {
updateTeamCallback(team: Teams$Team): void {
(this: any).setState({ team });
}
updateUsersCallback(users: Array<TeamMember>): void {
updateUsersCallback(users: Array<Team$TeamMemeber>): void {
(this: any).setState({ users });
}

View file

@ -24,7 +24,7 @@ const Wrapper = styled.div`
type Props = {
tabState: Function,
teams: Array<Team>
teams: Array<Teams$Team>
}
class SettingsTeams extends Component<Props> {

View file

@ -16,7 +16,7 @@ import { FormattedMessage } from "react-intl";
import update from "immutability-helper";
import styled from "styled-components";
import _ from "lodash";
import type { NewTeam } from "flow-typed";
import type { Teams$NewTeam } from "flow-typed";
import { createNewTeam } from "../../../../../services/api/teams_api";
import {
SETTINGS_TEAMS_ROUTE,
@ -48,7 +48,8 @@ const MyFormGroupDiv = styled.div`
`;
type Props = {
tabState: Function
tabState: Function,
getTeamsList: Function
};
type FormErrors = {
@ -57,7 +58,7 @@ type FormErrors = {
};
type State = {
team: NewTeam,
team: Teams$NewTeam,
formErrors: FormErrors,
redirectTo: string
};

8
flow-typed/team_types.js vendored Normal file
View 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
View 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
View file

@ -1,4 +1,5 @@
// @flow
import type { Teams$Team } from "flow-typed";
export type User = {
id: number,
@ -8,21 +9,6 @@ export type User = {
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 = {
message: string,
type: string,
@ -36,18 +22,9 @@ export type Activity = {
created_at: string
};
export type Team = {
id: number,
name: string,
current_team: boolean,
role: string,
members: number,
can_be_leaved: boolean
};
export type State = {
current_team: Team,
all_teams: Array<Team>,
current_team: Teams$Team,
all_teams: Array<Teams$Team>,
current_user: User,
showLeaveTeamModal: boolean,
alerts: Alert