
* refactored settings/team landing page * changed team edit flow, WIP * merge conflict fix for teams.tsx * minor fixes to edit team, WIP * invite-member and disband team APIs attached inside edit-team page * added remove-member API in edit-team page, minor fixes * minor code fix, WIP * WIP * add logo, bio, branding to team schema * bio, logo, branding, slug patch API and minor code fix-- WIP * fn to Disband team directly from the dropdown menu in settings/teams page, removed debug remnants --WIP * Pull latest data after an action in settings/teams-edit page * added slug conflict check at Patch time * code clean-up * initial change request fixes --WIP * prop type fix and add warn button color theme --WIP * added warn Button to Dialog * remaining change request fixes * added noop from react-query * updated invited team-list design * prettier fix for api/teams/profile * removed noop import and added custom noop * minor Button fix * requested changes addressed
39 lines
958 B
TypeScript
39 lines
958 B
TypeScript
import TeamListItem from "./TeamListItem";
|
|
import { Team } from "@lib/team";
|
|
|
|
export default function TeamList(props: {
|
|
teams: Team[];
|
|
onChange: () => void;
|
|
onEditTeam: (text: Team) => void;
|
|
}) {
|
|
const selectAction = (action: string, team: Team) => {
|
|
switch (action) {
|
|
case "edit":
|
|
props.onEditTeam(team);
|
|
break;
|
|
case "disband":
|
|
deleteTeam(team);
|
|
break;
|
|
}
|
|
};
|
|
|
|
const deleteTeam = (team: Team) => {
|
|
return fetch("/api/teams/" + team.id, {
|
|
method: "DELETE",
|
|
}).then(props.onChange());
|
|
};
|
|
|
|
return (
|
|
<div>
|
|
<ul className="px-4 mb-2 bg-white border divide-y divide-gray-200 rounded">
|
|
{props.teams.map((team: Team) => (
|
|
<TeamListItem
|
|
onChange={props.onChange}
|
|
key={team.id}
|
|
team={team}
|
|
onActionSelect={(action: string) => selectAction(action, team)}></TeamListItem>
|
|
))}
|
|
</ul>
|
|
</div>
|
|
);
|
|
}
|