2021-09-22 19:52:38 +00:00
|
|
|
import { UsersIcon } from "@heroicons/react/outline";
|
|
|
|
import { PlusIcon } from "@heroicons/react/solid";
|
2021-07-02 10:32:11 +00:00
|
|
|
import { GetServerSideProps } from "next";
|
2021-07-02 10:31:59 +00:00
|
|
|
import type { Session } from "next-auth";
|
2021-09-03 20:51:21 +00:00
|
|
|
import { useSession } from "next-auth/client";
|
2021-09-22 19:52:38 +00:00
|
|
|
import { useEffect, useRef, useState } from "react";
|
|
|
|
|
2021-09-03 20:51:21 +00:00
|
|
|
import { getSession } from "@lib/auth";
|
Cal 262 refactor edit teams according to the design reference (#516)
* 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
2021-09-06 13:22:22 +00:00
|
|
|
import { Member } from "@lib/member";
|
|
|
|
import { Team } from "@lib/team";
|
2021-09-22 19:52:38 +00:00
|
|
|
|
|
|
|
import Loader from "@components/Loader";
|
2021-09-29 21:33:18 +00:00
|
|
|
import SettingsShell from "@components/SettingsShell";
|
2021-09-22 19:52:38 +00:00
|
|
|
import Shell from "@components/Shell";
|
|
|
|
import EditTeam from "@components/team/EditTeam";
|
|
|
|
import TeamList from "@components/team/TeamList";
|
|
|
|
import TeamListItem from "@components/team/TeamListItem";
|
|
|
|
import Button from "@components/ui/Button";
|
2021-06-03 20:55:34 +00:00
|
|
|
|
2021-07-01 08:47:27 +00:00
|
|
|
export default function Teams() {
|
Cal 262 refactor edit teams according to the design reference (#516)
* 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
2021-09-06 13:22:22 +00:00
|
|
|
const noop = () => undefined;
|
2021-07-07 10:43:13 +00:00
|
|
|
const [, loading] = useSession();
|
2021-06-08 16:00:06 +00:00
|
|
|
const [teams, setTeams] = useState([]);
|
|
|
|
const [invites, setInvites] = useState([]);
|
|
|
|
const [showCreateTeamModal, setShowCreateTeamModal] = useState(false);
|
Cal 262 refactor edit teams according to the design reference (#516)
* 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
2021-09-06 13:22:22 +00:00
|
|
|
const [editTeamEnabled, setEditTeamEnabled] = useState(false);
|
|
|
|
const [teamToEdit, setTeamToEdit] = useState<Team | null>();
|
|
|
|
const nameRef = useRef<HTMLInputElement>() as React.MutableRefObject<HTMLInputElement>;
|
2021-06-05 22:53:33 +00:00
|
|
|
|
Cal 262 refactor edit teams according to the design reference (#516)
* 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
2021-09-06 13:22:22 +00:00
|
|
|
const handleErrors = async (resp: Response) => {
|
2021-07-01 08:47:27 +00:00
|
|
|
if (!resp.ok) {
|
|
|
|
const err = await resp.json();
|
|
|
|
throw new Error(err.message);
|
2021-06-05 22:53:33 +00:00
|
|
|
}
|
2021-07-01 08:47:27 +00:00
|
|
|
return resp.json();
|
2021-07-07 10:43:13 +00:00
|
|
|
};
|
2021-06-05 22:53:33 +00:00
|
|
|
|
2021-07-01 08:47:27 +00:00
|
|
|
const loadData = () => {
|
2021-07-01 09:30:10 +00:00
|
|
|
fetch("/api/user/membership")
|
2021-07-07 10:43:13 +00:00
|
|
|
.then(handleErrors)
|
|
|
|
.then((data) => {
|
Cal 262 refactor edit teams according to the design reference (#516)
* 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
2021-09-06 13:22:22 +00:00
|
|
|
setTeams(data.membership.filter((m: Member) => m.role !== "INVITEE"));
|
|
|
|
setInvites(data.membership.filter((m: Member) => m.role === "INVITEE"));
|
2021-07-07 10:43:13 +00:00
|
|
|
})
|
|
|
|
.catch(console.log);
|
|
|
|
};
|
2021-06-05 22:53:33 +00:00
|
|
|
|
2021-06-30 13:48:34 +00:00
|
|
|
useEffect(() => {
|
|
|
|
loadData();
|
|
|
|
}, []);
|
2021-06-03 20:55:34 +00:00
|
|
|
|
|
|
|
if (loading) {
|
2021-08-08 20:31:08 +00:00
|
|
|
return <Loader />;
|
2021-06-03 20:55:34 +00:00
|
|
|
}
|
|
|
|
|
Cal 262 refactor edit teams according to the design reference (#516)
* 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
2021-09-06 13:22:22 +00:00
|
|
|
const createTeam = (e: React.FormEvent<HTMLFormElement>) => {
|
2021-06-05 22:53:33 +00:00
|
|
|
e.preventDefault();
|
2021-07-07 10:43:13 +00:00
|
|
|
return fetch("/api/teams", {
|
|
|
|
method: "POST",
|
Cal 262 refactor edit teams according to the design reference (#516)
* 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
2021-09-06 13:22:22 +00:00
|
|
|
body: JSON.stringify({ name: nameRef?.current?.value }),
|
2021-06-05 22:53:33 +00:00
|
|
|
headers: {
|
2021-07-07 10:43:13 +00:00
|
|
|
"Content-Type": "application/json",
|
|
|
|
},
|
2021-06-08 16:00:06 +00:00
|
|
|
}).then(() => {
|
2021-06-30 13:48:34 +00:00
|
|
|
loadData();
|
2021-06-05 22:53:33 +00:00
|
|
|
setShowCreateTeamModal(false);
|
|
|
|
});
|
2021-07-07 10:43:13 +00:00
|
|
|
};
|
2021-06-03 20:55:34 +00:00
|
|
|
|
Cal 262 refactor edit teams according to the design reference (#516)
* 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
2021-09-06 13:22:22 +00:00
|
|
|
const editTeam = (team: Team) => {
|
|
|
|
setEditTeamEnabled(true);
|
|
|
|
setTeamToEdit(team);
|
|
|
|
};
|
|
|
|
|
|
|
|
const onCloseEdit = () => {
|
|
|
|
loadData();
|
|
|
|
setEditTeamEnabled(false);
|
|
|
|
};
|
|
|
|
|
2021-06-08 16:00:06 +00:00
|
|
|
return (
|
2021-08-02 14:10:24 +00:00
|
|
|
<Shell heading="Teams" subtitle="Create and manage teams to use collaborative features.">
|
2021-06-03 20:55:34 +00:00
|
|
|
<SettingsShell>
|
Cal 262 refactor edit teams according to the design reference (#516)
* 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
2021-09-06 13:22:22 +00:00
|
|
|
{!editTeamEnabled && (
|
|
|
|
<div className="divide-y divide-gray-200 lg:col-span-9">
|
|
|
|
<div className="py-6 lg:pb-8">
|
|
|
|
<div className="flex flex-col justify-between md:flex-row">
|
|
|
|
<div>
|
|
|
|
{!(invites.length || teams.length) && (
|
|
|
|
<div className="sm:rounded-sm">
|
|
|
|
<div className="pb-5 pr-4 sm:pb-6">
|
|
|
|
<h3 className="text-lg font-medium leading-6 text-gray-900">
|
|
|
|
Create a team to get started
|
|
|
|
</h3>
|
|
|
|
<div className="max-w-xl mt-2 text-sm text-gray-500">
|
|
|
|
<p>Create your first team and invite other users to work together with you.</p>
|
|
|
|
</div>
|
2021-06-08 16:00:06 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
Cal 262 refactor edit teams according to the design reference (#516)
* 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
2021-09-06 13:22:22 +00:00
|
|
|
)}
|
2021-07-07 10:43:13 +00:00
|
|
|
</div>
|
Cal 262 refactor edit teams according to the design reference (#516)
* 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
2021-09-06 13:22:22 +00:00
|
|
|
<div className="flex items-start mb-4">
|
|
|
|
<Button
|
|
|
|
type="button"
|
|
|
|
onClick={() => setShowCreateTeamModal(true)}
|
|
|
|
className="btn btn-white">
|
|
|
|
<PlusIcon className="group-hover:text-black text-gray-700 w-3.5 h-3.5 mr-2 inline-block" />
|
|
|
|
New Team
|
|
|
|
</Button>
|
2021-07-07 10:43:13 +00:00
|
|
|
</div>
|
2021-06-05 22:53:33 +00:00
|
|
|
</div>
|
|
|
|
<div>
|
Cal 262 refactor edit teams according to the design reference (#516)
* 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
2021-09-06 13:22:22 +00:00
|
|
|
{!!teams.length && (
|
|
|
|
<TeamList teams={teams} onChange={loadData} onEditTeam={editTeam}></TeamList>
|
|
|
|
)}
|
|
|
|
|
|
|
|
{!!invites.length && (
|
|
|
|
<div>
|
2021-09-22 21:23:19 +00:00
|
|
|
<h2 className="font-cal text-lg font-medium leading-6 text-gray-900">Open Invitations</h2>
|
Cal 262 refactor edit teams according to the design reference (#516)
* 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
2021-09-06 13:22:22 +00:00
|
|
|
<ul className="px-4 mt-4 mb-2 bg-white border divide-y divide-gray-200 rounded">
|
|
|
|
{invites.map((team: Team) => (
|
|
|
|
<TeamListItem
|
|
|
|
onChange={loadData}
|
|
|
|
key={team.id}
|
|
|
|
team={team}
|
|
|
|
onActionSelect={noop}></TeamListItem>
|
|
|
|
))}
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
)}
|
2021-06-05 22:53:33 +00:00
|
|
|
</div>
|
Cal 262 refactor edit teams according to the design reference (#516)
* 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
2021-09-06 13:22:22 +00:00
|
|
|
</div>
|
2021-06-03 20:55:34 +00:00
|
|
|
</div>
|
Cal 262 refactor edit teams according to the design reference (#516)
* 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
2021-09-06 13:22:22 +00:00
|
|
|
)}
|
|
|
|
{!!editTeamEnabled && <EditTeam team={teamToEdit} onCloseEdit={onCloseEdit} />}
|
2021-07-07 10:43:13 +00:00
|
|
|
{showCreateTeamModal && (
|
|
|
|
<div
|
Cal 262 refactor edit teams according to the design reference (#516)
* 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
2021-09-06 13:22:22 +00:00
|
|
|
className="fixed inset-0 z-50 overflow-y-auto"
|
2021-07-07 10:43:13 +00:00
|
|
|
aria-labelledby="modal-title"
|
|
|
|
role="dialog"
|
|
|
|
aria-modal="true">
|
Cal 262 refactor edit teams according to the design reference (#516)
* 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
2021-09-06 13:22:22 +00:00
|
|
|
<div className="flex items-end justify-center min-h-screen px-4 pt-4 pb-20 text-center sm:block sm:p-0">
|
2021-07-07 10:43:13 +00:00
|
|
|
<div
|
Cal 262 refactor edit teams according to the design reference (#516)
* 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
2021-09-06 13:22:22 +00:00
|
|
|
className="fixed inset-0 z-0 transition-opacity bg-gray-500 bg-opacity-75"
|
2021-07-07 10:43:13 +00:00
|
|
|
aria-hidden="true"></div>
|
2021-06-03 20:55:34 +00:00
|
|
|
|
2021-07-07 10:43:13 +00:00
|
|
|
<span className="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">
|
|
|
|
​
|
|
|
|
</span>
|
2021-06-03 20:55:34 +00:00
|
|
|
|
Cal 262 refactor edit teams according to the design reference (#516)
* 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
2021-09-06 13:22:22 +00:00
|
|
|
<div className="inline-block px-4 pt-5 pb-4 text-left align-bottom transition-all transform bg-white rounded-sm shadow-xl sm:my-8 sm:align-middle sm:max-w-lg sm:w-full sm:p-6">
|
|
|
|
<div className="mb-4 sm:flex sm:items-start">
|
|
|
|
<div className="flex items-center justify-center flex-shrink-0 w-12 h-12 mx-auto rounded-full bg-neutral-100 sm:mx-0 sm:h-10 sm:w-10">
|
|
|
|
<UsersIcon className="w-6 h-6 text-neutral-900" />
|
2021-06-08 16:00:06 +00:00
|
|
|
</div>
|
|
|
|
<div className="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left">
|
Cal 262 refactor edit teams according to the design reference (#516)
* 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
2021-09-06 13:22:22 +00:00
|
|
|
<h3 className="text-lg font-medium leading-6 text-gray-900" id="modal-title">
|
2021-07-07 10:43:13 +00:00
|
|
|
Create a new team
|
|
|
|
</h3>
|
2021-06-08 16:00:06 +00:00
|
|
|
<div>
|
2021-07-07 10:43:13 +00:00
|
|
|
<p className="text-sm text-gray-400">Create a new team to collaborate with users.</p>
|
2021-06-08 16:00:06 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2021-06-05 22:53:33 +00:00
|
|
|
</div>
|
2021-06-08 16:00:06 +00:00
|
|
|
<form onSubmit={createTeam}>
|
|
|
|
<div className="mb-4">
|
2021-07-07 10:43:13 +00:00
|
|
|
<label htmlFor="name" className="block text-sm font-medium text-gray-700">
|
|
|
|
Name
|
|
|
|
</label>
|
|
|
|
<input
|
Cal 262 refactor edit teams according to the design reference (#516)
* 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
2021-09-06 13:22:22 +00:00
|
|
|
ref={nameRef}
|
2021-07-07 10:43:13 +00:00
|
|
|
type="text"
|
|
|
|
name="name"
|
|
|
|
id="name"
|
|
|
|
placeholder="Acme Inc."
|
|
|
|
required
|
Cal 262 refactor edit teams according to the design reference (#516)
* 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
2021-09-06 13:22:22 +00:00
|
|
|
className="block w-full px-3 py-2 mt-1 border border-gray-300 rounded-sm shadow-sm focus:outline-none focus:ring-neutral-500 focus:border-neutral-500 sm:text-sm"
|
2021-07-07 10:43:13 +00:00
|
|
|
/>
|
2021-06-08 16:00:06 +00:00
|
|
|
</div>
|
|
|
|
<div className="mt-5 sm:mt-4 sm:flex sm:flex-row-reverse">
|
|
|
|
<button type="submit" className="btn btn-primary">
|
|
|
|
Create team
|
2021-07-07 10:43:13 +00:00
|
|
|
</button>
|
|
|
|
<button
|
|
|
|
onClick={() => setShowCreateTeamModal(false)}
|
|
|
|
type="button"
|
Cal 262 refactor edit teams according to the design reference (#516)
* 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
2021-09-06 13:22:22 +00:00
|
|
|
className="mr-2 btn btn-white">
|
2021-06-08 16:00:06 +00:00
|
|
|
Cancel
|
2021-07-07 10:43:13 +00:00
|
|
|
</button>
|
2021-06-08 16:00:06 +00:00
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
2021-06-03 20:55:34 +00:00
|
|
|
</div>
|
2021-06-05 22:53:33 +00:00
|
|
|
</div>
|
2021-07-07 10:43:13 +00:00
|
|
|
)}
|
2021-06-03 20:55:34 +00:00
|
|
|
</SettingsShell>
|
|
|
|
</Shell>
|
|
|
|
);
|
2021-06-30 13:48:34 +00:00
|
|
|
}
|
2021-07-02 10:28:33 +00:00
|
|
|
|
|
|
|
// Export the `session` prop to use sessions with Server Side Rendering
|
2021-07-02 10:32:27 +00:00
|
|
|
export const getServerSideProps: GetServerSideProps<{ session: Session | null }> = async (context) => {
|
2021-07-07 10:43:13 +00:00
|
|
|
const session = await getSession(context);
|
|
|
|
if (!session) {
|
|
|
|
return { redirect: { permanent: false, destination: "/auth/login" } };
|
|
|
|
}
|
2021-07-02 10:28:33 +00:00
|
|
|
|
2021-07-07 10:43:13 +00:00
|
|
|
return {
|
|
|
|
props: { session },
|
|
|
|
};
|
|
|
|
};
|