From c1d90eb43800a587912c4eda246e3414433ff8c1 Mon Sep 17 00:00:00 2001 From: Jamie Pine <32987599+jamiepine@users.noreply.github.com> Date: Thu, 9 Dec 2021 15:51:30 -0800 Subject: [PATCH] Improvement/teams (#1285) * [WIP] checkpoint before pull & merge - Added teams to sidebar - Refactored team settings - Improved team list UI This code will be partly reverted next commit. * [WIP] - Moved team code back to components - Removed team link from sidebar - Built new team manager screen based on Event Type designs - Component-ized frequently reused code (SettingInputContainer, FlatIconButton) * [WIP] - Created LinkIconButton as standalone component - Added functionality to sidebar of team settings - Fixed type bug on public team page induced by my normalization of members array in team query - Removed teams-old which was kept as refrence - Cleaned up loose ends * [WIP] - added create team model - fixed profile missing label due to my removal of default label from component * [WIP] - Fixed TeamCreateModal trigger - removed TeamShell, it didn't make the cut - added getPlaceHolderAvatar - renamed TeamCreate to TeamCreateModal - removed deprecated UsernameInput and replaced uses with suggested TextField * fix save button * [WIP] - Fixed drop down actions on team list - Cleaned up state updates * [WIP] converting teams to tRPC * [WIP] Finished refactor to tRPC * [WIP] Finishing touches * [WIP] Team availability beginning * team availability mvp * - added validation to change role - modified layout of team availability - corrected types * fix ui issue on team availability screen * - added virtualization to team availability - added flexChildrenContainer boolean to Shell to allow for flex on children * availability style fix * removed hard coded team type as teams now use inferred type from tRPC * Removed unneeded vscode settings * Reverted prisma schema * Fixed migrations * Removes unused dayjs plugins * Reverts type regression * Type fix * Type fixes * Type fixes * Moves team availability code to ee Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> Co-authored-by: zomars --- .vscode/settings.json | 6 +- components/ImageUploader.tsx | 2 +- components/Shell.tsx | 35 +- components/form/fields.tsx | 10 +- components/team/EditTeam.tsx | 289 -------------- components/team/MemberChangeRoleModal.tsx | 86 ++++ components/team/MemberInvitationModal.tsx | 58 ++- components/team/MemberList.tsx | 30 +- components/team/MemberListItem.tsx | 228 +++++++---- components/team/TeamCreateModal.tsx | 86 ++++ components/team/TeamList.tsx | 51 +-- components/team/TeamListItem.tsx | 271 +++++++------ components/team/TeamRole.tsx | 37 ++ components/team/TeamSettings.tsx | 210 ++++++++++ components/team/TeamSettingsRightSidebar.tsx | 123 ++++++ components/team/screens/Team.tsx | 27 +- components/ui/Button.tsx | 7 +- components/ui/LinkIconButton.tsx | 21 + components/ui/ModalContainer.tsx | 39 ++ components/ui/SettingInputContainer.tsx | 25 ++ components/ui/UsernameInput.tsx | 36 -- components/ui/form/DatePicker.tsx | 28 ++ components/ui/form/MinutesField.tsx | 20 +- .../availability/TeamAvailabilityModal.tsx | 92 +++++ .../availability/TeamAvailabilityScreen.tsx | 120 ++++++ .../availability/TeamAvailabilityTimes.tsx | 70 ++++ ee/pages/settings/teams/[id]/availability.tsx | 49 +++ lib/getPlaceholderAvatar.tsx | 6 + lib/queries/availability/index.ts | 88 ++++ lib/queries/teams/index.ts | 99 +++++ lib/team.ts | 10 - package.json | 5 + pages/api/teams.ts | 9 +- pages/api/teams/[team]/index.ts | 27 +- pages/api/teams/[team]/membership.ts | 9 +- pages/api/teams/[team]/profile.ts | 7 +- pages/api/user/membership.ts | 5 +- pages/settings/profile.tsx | 106 ++--- pages/settings/teams.tsx | 201 ++-------- pages/settings/teams/[id].tsx | 94 +++++ pages/settings/teams/[id]/availability.tsx | 1 + pages/team/[slug].tsx | 128 ++---- .../migration.sql | 2 + prisma/schema.prisma | 1 + public/static/locales/en/common.json | 8 + server/routers/viewer.tsx | 2 + server/routers/viewer/teams.tsx | 377 ++++++++++++++++++ styles/globals.css | 5 + yarn.lock | 47 ++- 49 files changed, 2295 insertions(+), 998 deletions(-) delete mode 100644 components/team/EditTeam.tsx create mode 100644 components/team/MemberChangeRoleModal.tsx create mode 100644 components/team/TeamCreateModal.tsx create mode 100644 components/team/TeamRole.tsx create mode 100644 components/team/TeamSettings.tsx create mode 100644 components/team/TeamSettingsRightSidebar.tsx create mode 100644 components/ui/LinkIconButton.tsx create mode 100644 components/ui/ModalContainer.tsx create mode 100644 components/ui/SettingInputContainer.tsx delete mode 100644 components/ui/UsernameInput.tsx create mode 100644 components/ui/form/DatePicker.tsx create mode 100644 ee/components/team/availability/TeamAvailabilityModal.tsx create mode 100644 ee/components/team/availability/TeamAvailabilityScreen.tsx create mode 100644 ee/components/team/availability/TeamAvailabilityTimes.tsx create mode 100644 ee/pages/settings/teams/[id]/availability.tsx create mode 100644 lib/getPlaceholderAvatar.tsx create mode 100644 lib/queries/availability/index.ts create mode 100644 lib/queries/teams/index.ts delete mode 100644 lib/team.ts create mode 100644 pages/settings/teams/[id].tsx create mode 100644 pages/settings/teams/[id]/availability.tsx create mode 100644 prisma/migrations/20211209201138_membership_admin_role/migration.sql create mode 100644 server/routers/viewer/teams.tsx diff --git a/.vscode/settings.json b/.vscode/settings.json index 451d01af..4bb9b697 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -5,9 +5,5 @@ "editor.codeActionsOnSave": { "source.fixAll.eslint": true }, - "eslint.run": "onSave", - "workbench.colorCustomizations": { - "titleBar.activeBackground": "#292929", - "titleBar.inactiveBackground": "#888888" - } + "eslint.run": "onSave" } diff --git a/components/ImageUploader.tsx b/components/ImageUploader.tsx index 6ed211e6..111d0f2a 100644 --- a/components/ImageUploader.tsx +++ b/components/ImageUploader.tsx @@ -110,7 +110,7 @@ export default function ImageUploader({ (opened) => !opened && setFile(null) // unset file on close }> -
+
diff --git a/components/Shell.tsx b/components/Shell.tsx index 13461bc2..7f96b648 100644 --- a/components/Shell.tsx +++ b/components/Shell.tsx @@ -1,6 +1,7 @@ import { SelectorIcon } from "@heroicons/react/outline"; import { CalendarIcon, + ArrowLeftIcon, ClockIcon, CogIcon, ExternalLinkIcon, @@ -36,6 +37,7 @@ import Dropdown, { import { useViewerI18n } from "./I18nLanguageHandler"; import Logo from "./Logo"; +import Button from "./ui/Button"; function useMeQuery() { const meQuery = trpc.useQuery(["viewer.me"], { @@ -118,6 +120,10 @@ export default function Shell(props: { subtitle?: ReactNode; children: ReactNode; CTA?: ReactNode; + HeadingLeftIcon?: ReactNode; + showBackButton?: boolean; + // use when content needs to expand with flex + flexChildrenContainer?: boolean; }) { const { t } = useLocale(); const router = useRouter(); @@ -249,7 +255,11 @@ export default function Shell(props: {
-
+
{/* show top navigation for md and smaller (tablet and phones) */}
-
+
+ {props.showBackButton && ( +
+ +
+ )}
+ {props.HeadingLeftIcon &&
{props.HeadingLeftIcon}
}

{props.heading} @@ -279,7 +302,13 @@ export default function Shell(props: {

{props.CTA}
-
{props.children}
+
+ {props.children} +
{/* show bottom navigation for md and smaller (tablet and phones) */}