2022-09-12 20:26:42 +00:00
|
|
|
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@radix-ui/react-collapsible";
|
2022-09-08 15:35:31 +00:00
|
|
|
import { useSession } from "next-auth/react";
|
2022-11-10 20:23:56 +00:00
|
|
|
import Link from "next/link";
|
2023-08-02 09:35:48 +00:00
|
|
|
import { usePathname, useRouter, useSearchParams } from "next/navigation";
|
2023-02-24 10:41:25 +00:00
|
|
|
import type { ComponentProps } from "react";
|
2023-04-15 00:04:48 +00:00
|
|
|
import React, { Suspense, useEffect, useState } from "react";
|
2022-08-09 09:21:15 +00:00
|
|
|
|
2023-01-10 15:39:29 +00:00
|
|
|
import Shell from "@calcom/features/shell/Shell";
|
2022-09-07 01:33:50 +00:00
|
|
|
import { classNames } from "@calcom/lib";
|
2022-11-23 02:55:25 +00:00
|
|
|
import { HOSTED_CAL_FEATURES, WEBAPP_URL } from "@calcom/lib/constants";
|
2022-09-21 04:53:31 +00:00
|
|
|
import { getPlaceholderAvatar } from "@calcom/lib/defaultAvatarImage";
|
2022-08-30 19:46:52 +00:00
|
|
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
2023-08-02 09:35:48 +00:00
|
|
|
import { IdentityProvider, MembershipRole, UserPermissionRole } from "@calcom/prisma/enums";
|
2022-09-12 20:26:42 +00:00
|
|
|
import { trpc } from "@calcom/trpc/react";
|
2023-02-24 10:41:25 +00:00
|
|
|
import type { VerticalTabItemProps } from "@calcom/ui";
|
2023-04-15 00:04:48 +00:00
|
|
|
import { Badge, Button, ErrorBoundary, Skeleton, useMeta, VerticalTabItem } from "@calcom/ui";
|
2023-01-23 23:08:01 +00:00
|
|
|
import {
|
2023-04-12 15:26:31 +00:00
|
|
|
ArrowLeft,
|
2023-08-02 09:35:48 +00:00
|
|
|
Building,
|
2023-04-12 15:26:31 +00:00
|
|
|
ChevronDown,
|
|
|
|
ChevronRight,
|
2023-08-02 09:35:48 +00:00
|
|
|
CreditCard,
|
|
|
|
Key,
|
|
|
|
Loader,
|
|
|
|
Lock,
|
2023-04-12 15:26:31 +00:00
|
|
|
Menu,
|
2023-08-02 09:35:48 +00:00
|
|
|
Plus,
|
|
|
|
Terminal,
|
|
|
|
User,
|
|
|
|
Users,
|
2023-01-23 23:08:01 +00:00
|
|
|
} from "@calcom/ui/components/icon";
|
2022-09-06 19:34:58 +00:00
|
|
|
|
2022-09-08 15:35:31 +00:00
|
|
|
const tabs: VerticalTabItemProps[] = [
|
2022-09-06 19:34:58 +00:00
|
|
|
{
|
|
|
|
name: "my_account",
|
2022-09-07 01:33:50 +00:00
|
|
|
href: "/settings/my-account",
|
2023-04-12 15:26:31 +00:00
|
|
|
icon: User,
|
2022-09-06 19:34:58 +00:00
|
|
|
children: [
|
|
|
|
{ name: "profile", href: "/settings/my-account/profile" },
|
|
|
|
{ name: "general", href: "/settings/my-account/general" },
|
|
|
|
{ name: "calendars", href: "/settings/my-account/calendars" },
|
|
|
|
{ name: "conferencing", href: "/settings/my-account/conferencing" },
|
|
|
|
{ name: "appearance", href: "/settings/my-account/appearance" },
|
|
|
|
// TODO
|
2022-09-07 01:33:50 +00:00
|
|
|
// { name: "referrals", href: "/settings/my-account/referrals" },
|
2022-09-06 19:34:58 +00:00
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "security",
|
|
|
|
href: "/settings/security",
|
2023-04-12 15:26:31 +00:00
|
|
|
icon: Key,
|
2022-09-06 19:34:58 +00:00
|
|
|
children: [
|
|
|
|
{ name: "password", href: "/settings/security/password" },
|
2022-10-19 09:33:40 +00:00
|
|
|
{ name: "impersonation", href: "/settings/security/impersonation" },
|
2023-06-05 12:04:48 +00:00
|
|
|
{ name: "2fa_auth", href: "/settings/security/two-factor-auth" },
|
2022-09-06 19:34:58 +00:00
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "billing",
|
|
|
|
href: "/settings/billing",
|
2023-04-12 15:26:31 +00:00
|
|
|
icon: CreditCard,
|
2022-10-04 22:54:15 +00:00
|
|
|
children: [{ name: "manage_billing", href: "/settings/billing" }],
|
2022-09-06 19:34:58 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "developer",
|
|
|
|
href: "/settings/developer",
|
2023-04-12 15:26:31 +00:00
|
|
|
icon: Terminal,
|
2022-09-06 19:34:58 +00:00
|
|
|
children: [
|
|
|
|
//
|
2022-09-07 01:33:50 +00:00
|
|
|
{ name: "webhooks", href: "/settings/developer/webhooks" },
|
2022-09-12 19:07:52 +00:00
|
|
|
{ name: "api_keys", href: "/settings/developer/api-keys" },
|
|
|
|
// TODO: Add profile level for embeds
|
|
|
|
// { name: "embeds", href: "/v2/settings/developer/embeds" },
|
2022-09-06 19:34:58 +00:00
|
|
|
],
|
|
|
|
},
|
feat: Org settings - profile,appearance, child teams, create new child (#9231)
* Initial commit
* Adding feature flag
* Desktop first banner, mobile pending
* Removing dead code and img
* AppInstallButtonBase
* WIP
* Adds Email verification template+translations for organizations (#9202)
* feat: Orgs Schema Changing `scopedMembers` to `orgUsers` (#9209)
* Change scopedMembers to orgMembers
* Change to orgUsers
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Session logic to show org label
* Step 2 done, avatar not working
* List orgs and list teams specific if orgs exist
* Conditionally show org - fix settings layout - add labels for all pages
* Profile Page + update
* Org specific team creation
* appearance page
* Ensure members cant of org cant update settings in UI
* Fix update handler imports
* hide billing on sub teams
* Update profile slug page
* Letting duplicate slugs for teams to support orgs
* Add slug coliisions for org
* Covering null on unique clauses
* Covering null on unique clauses
* Extract to utils
* Update settings to use subdomain path in team url , team + org
* Supporting having the orgId in the session cookie
* Onboarding admins step
* Last step to create teams
* Update handler comments
* Upgrade ORG banner - disabled team banner for child teams
* Handle publishing ORGS
* Fix licenese issue
* Update packages/trpc/server/routers/viewer/teams/create.handler.ts
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* A11ly
* Feedback
* Making an org avatar (temp)
* Add slug colission detection for user and team name
* Fix Import
* Remove update password func
* Fix module import over relative
* feat: organization event type filter (#9253)
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Missing changes to support orgs schema changes
* Remove app install button sa its in 9337
* Remove i18n key not being used
* feat: Onboarding process to create an organization (#9184)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Making sure we check requestedSlug now
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* feat: [CAL-1816] Organization subdomain support (#9345)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* Covering users and subteams, excluding non-org users
* Unpublished teams shows correctly
* Create subdomain in Vercel
* feedback
* Renaming Vercel env vars
* Vercel domain check before creation
* Supporting cal-staging.com
* Change to have vercel detect it
* vercel domain check data message error
* Remove check domain
* Making sure we check requestedSlug now
* Feedback and unneeded code
* Reverting unneeded changes
* Unneeded changes
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Vercel subdomain creation in PROD only
* feat: organization settings general and members page (#9266)
* feat: organization settings general page
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* feat: add members page
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* chore: remove
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: use invalidate
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: delete mutation
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: remove organization id
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* chore
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: use zod schema
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Type fixes
* Reverting changes
* Update UsernameTextfield.tsx
* More reverts
* Update next-auth-options.ts
* Update common.json
* Type fixes
* Include invite token for orgs
* Update org schema
* Make token settings optional as it isnt used in orgs yet
* Fix missing prop
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
Co-authored-by: Leo Giovanetti <hello@leog.me>
Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
Co-authored-by: zomars <zomars@me.com>
Co-authored-by: Hariom Balhara <hariombalhara@gmail.com>
2023-06-15 17:27:39 +00:00
|
|
|
{
|
|
|
|
name: "organization",
|
|
|
|
href: "/settings/organizations",
|
|
|
|
icon: Building,
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
name: "profile",
|
|
|
|
href: "/settings/organizations/profile",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "general",
|
|
|
|
href: "/settings/organizations/general",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "members",
|
|
|
|
href: "/settings/organizations/members",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "appearance",
|
|
|
|
href: "/settings/organizations/appearance",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "billing",
|
|
|
|
href: "/settings/organizations/billing",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2022-09-06 19:34:58 +00:00
|
|
|
{
|
|
|
|
name: "teams",
|
|
|
|
href: "/settings/teams",
|
2023-04-12 15:26:31 +00:00
|
|
|
icon: Users,
|
2022-09-07 01:33:50 +00:00
|
|
|
children: [],
|
2022-09-06 19:34:58 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "admin",
|
|
|
|
href: "/settings/admin",
|
2023-04-12 15:26:31 +00:00
|
|
|
icon: Lock,
|
2022-09-06 19:34:58 +00:00
|
|
|
children: [
|
|
|
|
//
|
2023-03-25 00:59:04 +00:00
|
|
|
{ name: "features", href: "/settings/admin/flags" },
|
Admin Wizard Choose License (#6574)
* Implementation
* i18n
* More i18n
* extracted i18n, needs api to get most recent price, added hint: update later
* Fixing i18n var
* Fix booking filters not working for admin (#6576)
* fix: react-select overflow issue in some modals. (#6587)
* feat: add a disable overflow prop
* feat: use the disable overflow prop
* Tailwind Merge (#6596)
* Tailwind Merge
* Fix merge classNames
* [CAL-808] /availability/single - UI issue on buttons beside time inputs (#6561)
* [CAL-808] /availability/single - UI issue on buttons beside time inputs
* Update apps/web/public/static/locales/en/common.json
* Update packages/features/schedules/components/Schedule.tsx
* create new translation for tooltip
Co-authored-by: gitstart-calcom <gitstart@users.noreply.github.com>
Co-authored-by: Peer Richelsen <peeroke@gmail.com>
Co-authored-by: CarinaWolli <wollencarina@gmail.com>
* Bye bye submodules (#6585)
* WIP
* Uses ssh instead
* Update .gitignore
* Update .gitignore
* Update Makefile
* Update git-setup.sh
* Update git-setup.sh
* Replaced Makefile with bash script
* Update package.json
* fix: show button on empty string (#6601)
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: add delete in dropdown (#6599)
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Update README.md
* Update README.md
* Changed a neutral- classes to gray (#6603)
* Changed a neutral- classes to gray
* Changed all border-1 to border
* Update package.json
* Test fixes
* Yarn lock fixes
* Fix string equality check in git-setup.sh
* [CAL-811] Avatar icon not redirecting user back to the main page (#6586)
* Remove cursor-pointer, remove old Avatar* files
* Fixed styling for checkedSelect + some cleanup
Co-authored-by: gitstart-calcom <gitstart@users.noreply.github.com>
Co-authored-by: Alex van Andel <me@alexvanandel.com>
* Harsh/add member invite (#6598)
Co-authored-by: Guest <guest@pop-os.localdomain>
Co-authored-by: root <harsh.singh@gocomet.com>
* Regenerated lockfile without upgrade (#6610)
* fix: remove annoying outline when <Button /> clicked (#6537)
* fix: remove annoying outline when <Button /> clicked
* Delete yarn.lock
* remove 1 on 1 icon (#6609)
* removed 1-on-1 badge
* changed user to users for group events
* fix: case-sensitivity in apps path (#6552)
* fix: lowercase slug
* fix: make fallback blocking
* Fix FAB (#6611)
* feat: add LocationSelect component (#6571)
* feat: add LocationSelect component
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: type error
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* chore: type error
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Update booking filters design (#6543)
* Update booking filters
* Add filter on YOUR bookings
* Fix pending members showing up in list
* Reduce the avatar size to 'sm' for now
* Bugfix/dropdown menu trigger as child remove class names (#6614)
* Fix UsernameTextfield to take right height
* Remove className side-effect
* Incorrect resolution version fixed
* Converted mobile DropdownMenuTrigger styles into Button
* v2.5.3
* fix: use items-center (#6618)
* fix tooltip and modal stacking issues (#6491)
* fix tooltip and modal stacking issues
* use z-index in larger screens and less
Co-authored-by: Alex van Andel <me@alexvanandel.com>
* Temporary fix (#6626)
* Fix Ga4 tracking (#6630)
* generic <UpgradeScreen> component (#6594)
* first attempt of <UpgradeScreen>
* changes to icons
* reverted changes back to initial state, needs fix: teams not showing
* WIP
* Fix weird reactnode error
* Fix loading text
* added upgradeTip to routing forms
* icon colors
* create and use hook to check if user has team plan
* use useTeamPlan for upgradeTeamsBadge
* replace huge svg with compressed jpeg
* responsive fixes
* Update packages/ui/components/badge/UpgradeTeamsBadge.tsx
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Give team plan features to E2E tests
* Allow option to make a user part of team int ests
* Remove flash of paywall for team user
* Add team user for typeform tests as well
Co-authored-by: Peer Richelsen <peer@cal.com>
Co-authored-by: CarinaWolli <wollencarina@gmail.com>
Co-authored-by: Carina Wollendorfer <30310907+CarinaWolli@users.noreply.github.com>
Co-authored-by: Alex van Andel <me@alexvanandel.com>
Co-authored-by: Hariom Balhara <hariombalhara@gmail.com>
* Removing env var to rely on db
* Restoring i18n keys, set loading moved
* Fixing tailwind-preset glob
* Wizard width fix for md+ screens
* Converting licenses options to radix radio
* Applying feedback + other tweaks
* Reverting this, not this PR related
* Unneeded code removal
* Reverting unneeded style change
* Applying feedback
* Removing licenseType
* Upgrades typescript
* Update yarn lock
* Typings
* Hotfix: ping,riverside,whereby and around not showing up in list (#6712)
* Hotfix: ping,riverside,whereby and around not showing up in list (#6712) (#6713)
* Adds deployment settings to DB (#6706)
* WIP
* Adds DeploymentTheme
* Add missing migrations
* Adds client extensions for deployment
* Cleanup
* Delete migration.sql
* Relying on both, env var and new model
* Restoring env example doc for backward compat
* Maximum call stack size exceeded fix?
* Revert upgrade
* Update index.ts
* Delete index.ts
* Not exposing license key, fixed radio behavior
* Covering undefined env var
* Self contained checkLicense
* Feedback
* Moar feedback
* Feedback
* Feedback
* Feedback
* Cleanup
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
Co-authored-by: Peer Richelsen <peer@cal.com>
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
Co-authored-by: Nafees Nazik <84864519+G3root@users.noreply.github.com>
Co-authored-by: GitStart-Cal.com <121884634+gitstart-calcom@users.noreply.github.com>
Co-authored-by: gitstart-calcom <gitstart@users.noreply.github.com>
Co-authored-by: Peer Richelsen <peeroke@gmail.com>
Co-authored-by: CarinaWolli <wollencarina@gmail.com>
Co-authored-by: Omar López <zomars@me.com>
Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
Co-authored-by: Alex van Andel <me@alexvanandel.com>
Co-authored-by: Harsh Singh <51085015+harshsinghatz@users.noreply.github.com>
Co-authored-by: Guest <guest@pop-os.localdomain>
Co-authored-by: root <harsh.singh@gocomet.com>
Co-authored-by: Luis Cadillo <luiscaf3r@gmail.com>
Co-authored-by: Mohammed Cherfaoui <hi@cherfaoui.dev>
Co-authored-by: Hariom Balhara <hariombalhara@gmail.com>
Co-authored-by: Carina Wollendorfer <30310907+CarinaWolli@users.noreply.github.com>
2023-02-08 00:23:42 +00:00
|
|
|
{ name: "license", href: "/auth/setup?step=1" },
|
2022-09-06 19:34:58 +00:00
|
|
|
{ name: "impersonation", href: "/settings/admin/impersonation" },
|
2022-12-07 21:47:02 +00:00
|
|
|
{ name: "apps", href: "/settings/admin/apps/calendar" },
|
2023-04-15 00:04:48 +00:00
|
|
|
{ name: "users", href: "/settings/admin/users" },
|
feat: org invite billing (#9291)
* Initial commit
* Adding feature flag
* Desktop first banner, mobile pending
* Removing dead code and img
* AppInstallButtonBase
* WIP
* Adds Email verification template+translations for organizations (#9202)
* feat: Orgs Schema Changing `scopedMembers` to `orgUsers` (#9209)
* Change scopedMembers to orgMembers
* Change to orgUsers
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Session logic to show org label
* Step 2 done, avatar not working
* List orgs and list teams specific if orgs exist
* Conditionally show org - fix settings layout - add labels for all pages
* Profile Page + update
* Org specific team creation
* appearance page
* Ensure members cant of org cant update settings in UI
* Fix update handler imports
* hide billing on sub teams
* Update profile slug page
* Letting duplicate slugs for teams to support orgs
* Add slug coliisions for org
* Covering null on unique clauses
* Covering null on unique clauses
* Extract to utils
* Update settings to use subdomain path in team url , team + org
* Supporting having the orgId in the session cookie
* Onboarding admins step
* Last step to create teams
* Update handler comments
* Upgrade ORG banner - disabled team banner for child teams
* Handle publishing ORGS
* Fix licenese issue
* Update packages/trpc/server/routers/viewer/teams/create.handler.ts
* Split into function calls to make this file more explisit
* Update parents stripe sub not teamID
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Create org membership also - billing portal page
* A11ly
* Hide create team if no valid permisisons
* Get Org members router
* Handle updating subscription if orgId
* Fix double upgrade banner
* Update constants
* Feedback
* Copy change
* Making an org avatar (temp)
* Add slug colission detection for user and team name
* Fix Import
* Remove update password func
* Fix module import over relative
* feat: organization event type filter (#9253)
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Missing changes to support orgs schema changes
* Fix import again
* Throw no team found before auth error
* Check if invited found user is already in differnt org
* Move to for of loop to throw errors in usenamelist
* Remove app install button sa its in 9337
* Remove i18n key not being used
* feat: Onboarding process to create an organization (#9184)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Making sure we check requestedSlug now
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* feat: [CAL-1816] Organization subdomain support (#9345)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* Covering users and subteams, excluding non-org users
* Unpublished teams shows correctly
* Create subdomain in Vercel
* feedback
* Renaming Vercel env vars
* Vercel domain check before creation
* Supporting cal-staging.com
* Change to have vercel detect it
* vercel domain check data message error
* Remove check domain
* Making sure we check requestedSlug now
* Feedback and unneeded code
* Reverting unneeded changes
* Unneeded changes
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Vercel subdomain creation in PROD only
* Fix router
* feat: organization settings general and members page (#9266)
* feat: organization settings general page
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* feat: add members page
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* chore: remove
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: use invalidate
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: delete mutation
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: remove organization id
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* chore
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: use zod schema
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Type fixes
* Use org Stripe product when upgrading
* Removed unused code
* Reverting changes
* Update UsernameTextfield.tsx
* More reverts
* Update next-auth-options.ts
* Update common.json
* Type fixes
* Include invite token for orgs
* Update org schema
* Make token settings optional as it isnt used in orgs yet
* Reverts
* remove yarn.lock from commit
* Fix types
* feat: orgs unverified (#9415)
Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
Co-authored-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
Co-authored-by: Keith Williams <keithwillcode@gmail.com>
* Fix wrong banner being displayed
* Type fix
* Fix type issues
* Update packages/trpc/server/routers/viewer/teams/inviteMember.handler.ts
Co-authored-by: alannnc <alannnc@gmail.com>
* fix missing input on trpc query
* Fix for parentId value for createProvisionalMembership
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
Co-authored-by: Leo Giovanetti <hello@leog.me>
Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
Co-authored-by: zomars <zomars@me.com>
Co-authored-by: Joe Au-Yeung <j.auyeung419@gmail.com>
Co-authored-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
Co-authored-by: Keith Williams <keithwillcode@gmail.com>
Co-authored-by: alannnc <alannnc@gmail.com>
2023-07-02 18:40:12 +00:00
|
|
|
{ name: "organizations", href: "/settings/admin/organizations" },
|
2023-08-10 18:52:36 +00:00
|
|
|
{ name: "kyc_verification", href: "/settings/admin/kycVerification" },
|
2022-09-06 19:34:58 +00:00
|
|
|
],
|
|
|
|
},
|
|
|
|
];
|
2022-08-09 09:21:15 +00:00
|
|
|
|
2022-10-18 20:34:32 +00:00
|
|
|
tabs.find((tab) => {
|
|
|
|
// Add "SAML SSO" to the tab
|
|
|
|
if (tab.name === "security" && !HOSTED_CAL_FEATURES) {
|
2023-06-08 13:37:54 +00:00
|
|
|
tab.children?.push({ name: "sso_configuration", href: "/settings/security/sso" });
|
2022-10-18 20:34:32 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2022-09-08 15:35:31 +00:00
|
|
|
// The following keys are assigned to admin only
|
|
|
|
const adminRequiredKeys = ["admin"];
|
feat: Org settings - profile,appearance, child teams, create new child (#9231)
* Initial commit
* Adding feature flag
* Desktop first banner, mobile pending
* Removing dead code and img
* AppInstallButtonBase
* WIP
* Adds Email verification template+translations for organizations (#9202)
* feat: Orgs Schema Changing `scopedMembers` to `orgUsers` (#9209)
* Change scopedMembers to orgMembers
* Change to orgUsers
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Session logic to show org label
* Step 2 done, avatar not working
* List orgs and list teams specific if orgs exist
* Conditionally show org - fix settings layout - add labels for all pages
* Profile Page + update
* Org specific team creation
* appearance page
* Ensure members cant of org cant update settings in UI
* Fix update handler imports
* hide billing on sub teams
* Update profile slug page
* Letting duplicate slugs for teams to support orgs
* Add slug coliisions for org
* Covering null on unique clauses
* Covering null on unique clauses
* Extract to utils
* Update settings to use subdomain path in team url , team + org
* Supporting having the orgId in the session cookie
* Onboarding admins step
* Last step to create teams
* Update handler comments
* Upgrade ORG banner - disabled team banner for child teams
* Handle publishing ORGS
* Fix licenese issue
* Update packages/trpc/server/routers/viewer/teams/create.handler.ts
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* A11ly
* Feedback
* Making an org avatar (temp)
* Add slug colission detection for user and team name
* Fix Import
* Remove update password func
* Fix module import over relative
* feat: organization event type filter (#9253)
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Missing changes to support orgs schema changes
* Remove app install button sa its in 9337
* Remove i18n key not being used
* feat: Onboarding process to create an organization (#9184)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Making sure we check requestedSlug now
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* feat: [CAL-1816] Organization subdomain support (#9345)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* Covering users and subteams, excluding non-org users
* Unpublished teams shows correctly
* Create subdomain in Vercel
* feedback
* Renaming Vercel env vars
* Vercel domain check before creation
* Supporting cal-staging.com
* Change to have vercel detect it
* vercel domain check data message error
* Remove check domain
* Making sure we check requestedSlug now
* Feedback and unneeded code
* Reverting unneeded changes
* Unneeded changes
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Vercel subdomain creation in PROD only
* feat: organization settings general and members page (#9266)
* feat: organization settings general page
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* feat: add members page
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* chore: remove
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: use invalidate
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: delete mutation
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: remove organization id
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* chore
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: use zod schema
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Type fixes
* Reverting changes
* Update UsernameTextfield.tsx
* More reverts
* Update next-auth-options.ts
* Update common.json
* Type fixes
* Include invite token for orgs
* Update org schema
* Make token settings optional as it isnt used in orgs yet
* Fix missing prop
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
Co-authored-by: Leo Giovanetti <hello@leog.me>
Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
Co-authored-by: zomars <zomars@me.com>
Co-authored-by: Hariom Balhara <hariombalhara@gmail.com>
2023-06-15 17:27:39 +00:00
|
|
|
const organizationRequiredKeys = ["organization"];
|
2022-09-08 15:35:31 +00:00
|
|
|
|
|
|
|
const useTabs = () => {
|
|
|
|
const session = useSession();
|
2023-05-20 00:37:58 +00:00
|
|
|
const { data: user } = trpc.viewer.me.useQuery();
|
2022-09-13 16:11:37 +00:00
|
|
|
|
|
|
|
const isAdmin = session.data?.user.role === UserPermissionRole.ADMIN;
|
2022-12-26 10:23:03 +00:00
|
|
|
|
|
|
|
tabs.map((tab) => {
|
2023-05-20 00:37:58 +00:00
|
|
|
if (tab.href === "/settings/my-account") {
|
|
|
|
tab.name = user?.name || "my_account";
|
2022-12-26 10:23:03 +00:00
|
|
|
tab.icon = undefined;
|
2023-08-10 17:07:09 +00:00
|
|
|
tab.avatar = WEBAPP_URL + "/" + session?.data?.user?.username + "/avatar.png";
|
2023-07-21 08:32:03 +00:00
|
|
|
} else if (
|
|
|
|
tab.href === "/settings/security" &&
|
|
|
|
user?.identityProvider === IdentityProvider.GOOGLE &&
|
|
|
|
!user?.twoFactorEnabled
|
|
|
|
) {
|
2023-06-05 12:04:48 +00:00
|
|
|
tab.children = tab?.children?.filter(
|
|
|
|
(childTab) => childTab.href !== "/settings/security/two-factor-auth"
|
|
|
|
);
|
2022-12-26 10:23:03 +00:00
|
|
|
}
|
|
|
|
return tab;
|
|
|
|
});
|
|
|
|
|
2022-09-08 15:35:31 +00:00
|
|
|
// check if name is in adminRequiredKeys
|
|
|
|
return tabs.filter((tab) => {
|
feat: Org settings - profile,appearance, child teams, create new child (#9231)
* Initial commit
* Adding feature flag
* Desktop first banner, mobile pending
* Removing dead code and img
* AppInstallButtonBase
* WIP
* Adds Email verification template+translations for organizations (#9202)
* feat: Orgs Schema Changing `scopedMembers` to `orgUsers` (#9209)
* Change scopedMembers to orgMembers
* Change to orgUsers
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Session logic to show org label
* Step 2 done, avatar not working
* List orgs and list teams specific if orgs exist
* Conditionally show org - fix settings layout - add labels for all pages
* Profile Page + update
* Org specific team creation
* appearance page
* Ensure members cant of org cant update settings in UI
* Fix update handler imports
* hide billing on sub teams
* Update profile slug page
* Letting duplicate slugs for teams to support orgs
* Add slug coliisions for org
* Covering null on unique clauses
* Covering null on unique clauses
* Extract to utils
* Update settings to use subdomain path in team url , team + org
* Supporting having the orgId in the session cookie
* Onboarding admins step
* Last step to create teams
* Update handler comments
* Upgrade ORG banner - disabled team banner for child teams
* Handle publishing ORGS
* Fix licenese issue
* Update packages/trpc/server/routers/viewer/teams/create.handler.ts
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* A11ly
* Feedback
* Making an org avatar (temp)
* Add slug colission detection for user and team name
* Fix Import
* Remove update password func
* Fix module import over relative
* feat: organization event type filter (#9253)
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Missing changes to support orgs schema changes
* Remove app install button sa its in 9337
* Remove i18n key not being used
* feat: Onboarding process to create an organization (#9184)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Making sure we check requestedSlug now
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* feat: [CAL-1816] Organization subdomain support (#9345)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* Covering users and subteams, excluding non-org users
* Unpublished teams shows correctly
* Create subdomain in Vercel
* feedback
* Renaming Vercel env vars
* Vercel domain check before creation
* Supporting cal-staging.com
* Change to have vercel detect it
* vercel domain check data message error
* Remove check domain
* Making sure we check requestedSlug now
* Feedback and unneeded code
* Reverting unneeded changes
* Unneeded changes
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Vercel subdomain creation in PROD only
* feat: organization settings general and members page (#9266)
* feat: organization settings general page
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* feat: add members page
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* chore: remove
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: use invalidate
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: delete mutation
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: remove organization id
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* chore
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: use zod schema
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Type fixes
* Reverting changes
* Update UsernameTextfield.tsx
* More reverts
* Update next-auth-options.ts
* Update common.json
* Type fixes
* Include invite token for orgs
* Update org schema
* Make token settings optional as it isnt used in orgs yet
* Fix missing prop
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
Co-authored-by: Leo Giovanetti <hello@leog.me>
Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
Co-authored-by: zomars <zomars@me.com>
Co-authored-by: Hariom Balhara <hariombalhara@gmail.com>
2023-06-15 17:27:39 +00:00
|
|
|
if (organizationRequiredKeys.includes(tab.name)) return !!session.data?.user?.organizationId;
|
|
|
|
|
2022-09-08 15:35:31 +00:00
|
|
|
if (isAdmin) return true;
|
|
|
|
return !adminRequiredKeys.includes(tab.name);
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2022-12-26 10:23:03 +00:00
|
|
|
const BackButtonInSidebar = ({ name }: { name: string }) => {
|
|
|
|
return (
|
2023-03-09 13:44:00 +00:00
|
|
|
<Link
|
|
|
|
href="/"
|
2023-06-22 22:25:37 +00:00
|
|
|
className="hover:bg-subtle [&[aria-current='page']]:bg-emphasis [&[aria-current='page']]:text-emphasis group-hover:text-default text-emphasis group my-6 flex h-6 max-h-6 w-full flex-row items-center rounded-md px-3 py-2 text-sm font-medium leading-4"
|
2023-03-09 13:44:00 +00:00
|
|
|
data-testid={`vertical-tab-${name}`}>
|
2023-04-27 08:07:32 +00:00
|
|
|
<ArrowLeft className="h-4 w-4 stroke-[2px] ltr:mr-[10px] rtl:ml-[10px] rtl:rotate-180 md:mt-0" />
|
2023-06-20 10:20:13 +00:00
|
|
|
<Skeleton title={name} as="p" className="max-w-36 min-h-4 truncate" loadingClassName="ms-3">
|
2023-01-06 12:13:56 +00:00
|
|
|
{name}
|
|
|
|
</Skeleton>
|
2023-03-09 13:44:00 +00:00
|
|
|
</Link>
|
2022-12-26 10:23:03 +00:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2022-12-19 17:37:20 +00:00
|
|
|
interface SettingsSidebarContainerProps {
|
|
|
|
className?: string;
|
|
|
|
navigationIsOpenedOnMobile?: boolean;
|
2023-07-31 18:51:08 +00:00
|
|
|
bannersHeight?: number;
|
2022-12-19 17:37:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const SettingsSidebarContainer = ({
|
|
|
|
className = "",
|
|
|
|
navigationIsOpenedOnMobile,
|
2023-07-31 18:51:08 +00:00
|
|
|
bannersHeight,
|
2022-12-19 17:37:20 +00:00
|
|
|
}: SettingsSidebarContainerProps) => {
|
2023-08-02 09:35:48 +00:00
|
|
|
const searchParams = useSearchParams();
|
2022-09-12 20:26:42 +00:00
|
|
|
const { t } = useLocale();
|
2022-09-08 15:35:31 +00:00
|
|
|
const tabsWithPermissions = useTabs();
|
2022-09-12 20:26:42 +00:00
|
|
|
const [teamMenuState, setTeamMenuState] =
|
|
|
|
useState<{ teamId: number | undefined; teamMenuOpen: boolean }[]>();
|
2023-08-02 19:09:43 +00:00
|
|
|
const [otherTeamMenuState, setOtherTeamMenuState] = useState<
|
|
|
|
{
|
|
|
|
teamId: number | undefined;
|
|
|
|
teamMenuOpen: boolean;
|
|
|
|
}[]
|
|
|
|
>();
|
2022-11-10 23:40:01 +00:00
|
|
|
const { data: teams } = trpc.viewer.teams.list.useQuery();
|
2023-08-02 09:35:48 +00:00
|
|
|
const session = useSession();
|
|
|
|
const { data: currentOrg } = trpc.viewer.organizations.listCurrent.useQuery(undefined, {
|
|
|
|
enabled: !!session.data?.user?.organizationId,
|
|
|
|
});
|
2022-09-12 20:26:42 +00:00
|
|
|
|
2023-08-02 19:09:43 +00:00
|
|
|
const { data: otherTeams } = trpc.viewer.organizations.listOtherTeams.useQuery();
|
|
|
|
|
2022-09-12 20:26:42 +00:00
|
|
|
useEffect(() => {
|
|
|
|
if (teams) {
|
2022-12-07 21:35:41 +00:00
|
|
|
const teamStates = teams?.map((team) => ({
|
|
|
|
teamId: team.id,
|
2023-08-02 09:35:48 +00:00
|
|
|
teamMenuOpen: String(team.id) === searchParams?.get("id"),
|
2022-12-07 21:35:41 +00:00
|
|
|
}));
|
2022-09-12 20:26:42 +00:00
|
|
|
setTeamMenuState(teamStates);
|
2022-12-07 21:35:41 +00:00
|
|
|
setTimeout(() => {
|
|
|
|
const tabMembers = Array.from(document.getElementsByTagName("a")).filter(
|
|
|
|
(bottom) => bottom.dataset.testid === "vertical-tab-Members"
|
|
|
|
)[1];
|
|
|
|
tabMembers?.scrollIntoView({ behavior: "smooth" });
|
|
|
|
}, 100);
|
2022-09-12 20:26:42 +00:00
|
|
|
}
|
2023-08-02 09:35:48 +00:00
|
|
|
}, [searchParams?.get("id"), teams]);
|
2022-09-12 20:26:42 +00:00
|
|
|
|
2023-08-02 19:09:43 +00:00
|
|
|
// Same as above but for otherTeams
|
|
|
|
useEffect(() => {
|
|
|
|
if (otherTeams) {
|
|
|
|
const otherTeamStates = otherTeams?.map((team) => ({
|
|
|
|
teamId: team.id,
|
|
|
|
teamMenuOpen: String(team.id) === searchParams?.get("id"),
|
|
|
|
}));
|
|
|
|
setOtherTeamMenuState(otherTeamStates);
|
|
|
|
setTimeout(() => {
|
|
|
|
// @TODO: test if this works for 2 dataset testids
|
|
|
|
const tabMembers = Array.from(document.getElementsByTagName("a")).filter(
|
|
|
|
(bottom) => bottom.dataset.testid === "vertical-tab-Members"
|
|
|
|
)[1];
|
|
|
|
tabMembers?.scrollIntoView({ behavior: "smooth" });
|
|
|
|
}, 100);
|
|
|
|
}
|
|
|
|
}, [searchParams?.get("id"), otherTeams]);
|
|
|
|
|
2023-08-18 21:10:17 +00:00
|
|
|
const isOrgAdminOrOwner =
|
|
|
|
currentOrg && currentOrg?.user?.role && ["OWNER", "ADMIN"].includes(currentOrg?.user?.role);
|
|
|
|
|
|
|
|
if (isOrgAdminOrOwner) {
|
2023-08-02 19:09:43 +00:00
|
|
|
const teamsIndex = tabsWithPermissions.findIndex((tab) => tab.name === "teams");
|
|
|
|
|
|
|
|
tabsWithPermissions.splice(teamsIndex + 1, 0, {
|
|
|
|
name: "other_teams",
|
|
|
|
href: "/settings/organizations/teams/other",
|
|
|
|
icon: Users,
|
|
|
|
children: [],
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-09-07 01:33:50 +00:00
|
|
|
return (
|
2022-09-12 20:26:42 +00:00
|
|
|
<nav
|
2023-07-31 18:51:08 +00:00
|
|
|
style={{ maxHeight: `calc(100vh - ${bannersHeight}px)`, top: `${bannersHeight}px` }}
|
2022-12-19 17:37:20 +00:00
|
|
|
className={classNames(
|
2023-04-05 18:14:46 +00:00
|
|
|
"no-scrollbar bg-muted fixed bottom-0 left-0 top-0 z-20 flex max-h-screen w-56 flex-col space-y-1 overflow-x-hidden overflow-y-scroll px-2 pb-3 transition-transform max-lg:z-10 lg:sticky lg:flex",
|
2022-12-19 17:37:20 +00:00
|
|
|
className,
|
|
|
|
navigationIsOpenedOnMobile
|
2023-01-07 10:10:35 +00:00
|
|
|
? "translate-x-0 opacity-100"
|
2023-01-04 15:46:42 +00:00
|
|
|
: "-translate-x-full opacity-0 lg:translate-x-0 lg:opacity-100"
|
2022-12-19 17:37:20 +00:00
|
|
|
)}
|
2022-09-12 20:26:42 +00:00
|
|
|
aria-label="Tabs">
|
|
|
|
<>
|
2022-12-26 10:23:03 +00:00
|
|
|
<BackButtonInSidebar name={t("back")} />
|
2022-09-12 20:26:42 +00:00
|
|
|
{tabsWithPermissions.map((tab) => {
|
2023-08-02 19:09:43 +00:00
|
|
|
return (
|
2023-08-18 22:50:44 +00:00
|
|
|
<React.Fragment key={tab.href}>
|
2023-08-02 19:09:43 +00:00
|
|
|
{!["teams", "other_teams"].includes(tab.name) && (
|
|
|
|
<React.Fragment key={tab.href}>
|
|
|
|
<div className={`${!tab.children?.length ? "!mb-3" : ""}`}>
|
|
|
|
<div className="[&[aria-current='page']]:bg-emphasis [&[aria-current='page']]:text-emphasis text-default group flex h-9 w-full flex-row items-center rounded-md px-2 text-sm font-medium leading-none">
|
|
|
|
{tab && tab.icon && (
|
|
|
|
<tab.icon className="h-[16px] w-[16px] stroke-[2px] ltr:mr-3 rtl:ml-3 md:mt-0" />
|
|
|
|
)}
|
|
|
|
{!tab.icon && tab?.avatar && (
|
|
|
|
<img
|
|
|
|
className="h-4 w-4 rounded-full ltr:mr-3 rtl:ml-3"
|
|
|
|
src={tab?.avatar}
|
|
|
|
alt="User Avatar"
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
<Skeleton
|
|
|
|
title={tab.name}
|
|
|
|
as="p"
|
|
|
|
className="truncate text-sm font-medium leading-5"
|
|
|
|
loadingClassName="ms-3">
|
|
|
|
{t(tab.name)}
|
|
|
|
</Skeleton>
|
|
|
|
</div>
|
2023-01-06 12:13:56 +00:00
|
|
|
</div>
|
2023-08-02 19:09:43 +00:00
|
|
|
<div className="my-3 space-y-0.5">
|
|
|
|
{tab.children?.map((child, index) => (
|
|
|
|
<VerticalTabItem
|
|
|
|
key={child.href}
|
|
|
|
name={t(child.name)}
|
|
|
|
isExternalLink={child.isExternalLink}
|
|
|
|
href={child.href || "/"}
|
|
|
|
textClassNames="px-3 text-emphasis font-medium text-sm"
|
|
|
|
className={`my-0.5 me-5 h-7 ${
|
|
|
|
tab.children && index === tab.children?.length - 1 && "!mb-3"
|
|
|
|
}`}
|
|
|
|
disableChevron
|
|
|
|
/>
|
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
</React.Fragment>
|
|
|
|
)}
|
|
|
|
|
|
|
|
{tab.name === "teams" && (
|
|
|
|
<React.Fragment key={tab.href}>
|
|
|
|
<div className={`${!tab.children?.length ? "mb-3" : ""}`}>
|
|
|
|
<Link href={tab.href}>
|
|
|
|
<div className="hover:bg-subtle [&[aria-current='page']]:bg-emphasis [&[aria-current='page']]:text-emphasis group-hover:text-default text-default group flex h-9 w-full flex-row items-center rounded-md px-2 py-[10px] text-sm font-medium leading-none">
|
|
|
|
{tab && tab.icon && (
|
|
|
|
<tab.icon className="h-[16px] w-[16px] stroke-[2px] ltr:mr-3 rtl:ml-3 md:mt-0" />
|
|
|
|
)}
|
|
|
|
<Skeleton
|
|
|
|
title={tab.name}
|
|
|
|
as="p"
|
|
|
|
className="truncate text-sm font-medium leading-5"
|
|
|
|
loadingClassName="ms-3">
|
2023-08-18 21:10:17 +00:00
|
|
|
{t(isOrgAdminOrOwner ? "my_teams" : tab.name)}
|
2023-08-02 19:09:43 +00:00
|
|
|
</Skeleton>
|
|
|
|
</div>
|
|
|
|
</Link>
|
|
|
|
{teams &&
|
|
|
|
teamMenuState &&
|
|
|
|
teams.map((team, index: number) => {
|
|
|
|
if (!teamMenuState[index]) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
if (teamMenuState.some((teamState) => teamState.teamId === team.id))
|
|
|
|
return (
|
|
|
|
<Collapsible
|
|
|
|
className="cursor-pointer"
|
|
|
|
key={team.id}
|
|
|
|
open={teamMenuState[index].teamMenuOpen}
|
|
|
|
onOpenChange={() =>
|
2022-09-15 09:47:59 +00:00
|
|
|
setTeamMenuState([
|
|
|
|
...teamMenuState,
|
|
|
|
(teamMenuState[index] = {
|
|
|
|
...teamMenuState[index],
|
|
|
|
teamMenuOpen: !teamMenuState[index].teamMenuOpen,
|
|
|
|
}),
|
|
|
|
])
|
|
|
|
}>
|
2023-08-02 19:09:43 +00:00
|
|
|
<CollapsibleTrigger asChild>
|
|
|
|
<div
|
|
|
|
className="hover:bg-subtle [&[aria-current='page']]:bg-emphasis [&[aria-current='page']]:text-emphasis text-default flex h-9 w-full flex-row items-center rounded-md px-3 py-[10px] text-left text-sm font-medium leading-none"
|
|
|
|
onClick={() =>
|
|
|
|
setTeamMenuState([
|
|
|
|
...teamMenuState,
|
|
|
|
(teamMenuState[index] = {
|
|
|
|
...teamMenuState[index],
|
|
|
|
teamMenuOpen: !teamMenuState[index].teamMenuOpen,
|
|
|
|
}),
|
|
|
|
])
|
|
|
|
}>
|
|
|
|
<div className="me-3">
|
|
|
|
{teamMenuState[index].teamMenuOpen ? (
|
|
|
|
<ChevronDown className="h-4 w-4" />
|
|
|
|
) : (
|
|
|
|
<ChevronRight className="h-4 w-4" />
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
<img
|
|
|
|
src={getPlaceholderAvatar(team.logo, team?.name as string)}
|
|
|
|
className="h-[16px] w-[16px] self-start rounded-full stroke-[2px] ltr:mr-2 rtl:ml-2 md:mt-0"
|
|
|
|
alt={team.name || "Team logo"}
|
|
|
|
/>
|
|
|
|
<p className="w-1/2 truncate">{team.name}</p>
|
|
|
|
{!team.accepted && (
|
|
|
|
<Badge className="ms-3" variant="orange">
|
|
|
|
Inv.
|
|
|
|
</Badge>
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
</CollapsibleTrigger>
|
|
|
|
<CollapsibleContent className="space-y-0.5">
|
|
|
|
{team.accepted && (
|
|
|
|
<VerticalTabItem
|
|
|
|
name={t("profile")}
|
|
|
|
href={`/settings/teams/${team.id}/profile`}
|
|
|
|
textClassNames="px-3 text-emphasis font-medium text-sm"
|
|
|
|
disableChevron
|
|
|
|
/>
|
2023-04-20 22:33:49 +00:00
|
|
|
)}
|
2022-09-15 09:47:59 +00:00
|
|
|
<VerticalTabItem
|
2023-08-02 19:09:43 +00:00
|
|
|
name={t("members")}
|
|
|
|
href={`/settings/teams/${team.id}/members`}
|
2023-04-05 18:14:46 +00:00
|
|
|
textClassNames="px-3 text-emphasis font-medium text-sm"
|
2022-09-15 09:47:59 +00:00
|
|
|
disableChevron
|
|
|
|
/>
|
2023-08-02 19:09:43 +00:00
|
|
|
{(team.role === MembershipRole.OWNER ||
|
|
|
|
team.role === MembershipRole.ADMIN ||
|
|
|
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
|
|
// @ts-ignore this exists wtf?
|
|
|
|
(team.isOrgAdmin && team.isOrgAdmin)) && (
|
feat: Org settings - profile,appearance, child teams, create new child (#9231)
* Initial commit
* Adding feature flag
* Desktop first banner, mobile pending
* Removing dead code and img
* AppInstallButtonBase
* WIP
* Adds Email verification template+translations for organizations (#9202)
* feat: Orgs Schema Changing `scopedMembers` to `orgUsers` (#9209)
* Change scopedMembers to orgMembers
* Change to orgUsers
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Session logic to show org label
* Step 2 done, avatar not working
* List orgs and list teams specific if orgs exist
* Conditionally show org - fix settings layout - add labels for all pages
* Profile Page + update
* Org specific team creation
* appearance page
* Ensure members cant of org cant update settings in UI
* Fix update handler imports
* hide billing on sub teams
* Update profile slug page
* Letting duplicate slugs for teams to support orgs
* Add slug coliisions for org
* Covering null on unique clauses
* Covering null on unique clauses
* Extract to utils
* Update settings to use subdomain path in team url , team + org
* Supporting having the orgId in the session cookie
* Onboarding admins step
* Last step to create teams
* Update handler comments
* Upgrade ORG banner - disabled team banner for child teams
* Handle publishing ORGS
* Fix licenese issue
* Update packages/trpc/server/routers/viewer/teams/create.handler.ts
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* A11ly
* Feedback
* Making an org avatar (temp)
* Add slug colission detection for user and team name
* Fix Import
* Remove update password func
* Fix module import over relative
* feat: organization event type filter (#9253)
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Missing changes to support orgs schema changes
* Remove app install button sa its in 9337
* Remove i18n key not being used
* feat: Onboarding process to create an organization (#9184)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Making sure we check requestedSlug now
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* feat: [CAL-1816] Organization subdomain support (#9345)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* Covering users and subteams, excluding non-org users
* Unpublished teams shows correctly
* Create subdomain in Vercel
* feedback
* Renaming Vercel env vars
* Vercel domain check before creation
* Supporting cal-staging.com
* Change to have vercel detect it
* vercel domain check data message error
* Remove check domain
* Making sure we check requestedSlug now
* Feedback and unneeded code
* Reverting unneeded changes
* Unneeded changes
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Vercel subdomain creation in PROD only
* feat: organization settings general and members page (#9266)
* feat: organization settings general page
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* feat: add members page
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* chore: remove
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: use invalidate
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: delete mutation
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: remove organization id
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* chore
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: use zod schema
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Type fixes
* Reverting changes
* Update UsernameTextfield.tsx
* More reverts
* Update next-auth-options.ts
* Update common.json
* Type fixes
* Include invite token for orgs
* Update org schema
* Make token settings optional as it isnt used in orgs yet
* Fix missing prop
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
Co-authored-by: Leo Giovanetti <hello@leog.me>
Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
Co-authored-by: zomars <zomars@me.com>
Co-authored-by: Hariom Balhara <hariombalhara@gmail.com>
2023-06-15 17:27:39 +00:00
|
|
|
<>
|
2023-08-02 19:09:43 +00:00
|
|
|
{/* TODO */}
|
|
|
|
{/* <VerticalTabItem
|
|
|
|
name={t("general")}
|
|
|
|
href={`${WEBAPP_URL}/settings/my-account/appearance`}
|
|
|
|
textClassNames="px-3 text-emphasis font-medium text-sm"
|
|
|
|
disableChevron
|
|
|
|
/> */}
|
feat: Org settings - profile,appearance, child teams, create new child (#9231)
* Initial commit
* Adding feature flag
* Desktop first banner, mobile pending
* Removing dead code and img
* AppInstallButtonBase
* WIP
* Adds Email verification template+translations for organizations (#9202)
* feat: Orgs Schema Changing `scopedMembers` to `orgUsers` (#9209)
* Change scopedMembers to orgMembers
* Change to orgUsers
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Session logic to show org label
* Step 2 done, avatar not working
* List orgs and list teams specific if orgs exist
* Conditionally show org - fix settings layout - add labels for all pages
* Profile Page + update
* Org specific team creation
* appearance page
* Ensure members cant of org cant update settings in UI
* Fix update handler imports
* hide billing on sub teams
* Update profile slug page
* Letting duplicate slugs for teams to support orgs
* Add slug coliisions for org
* Covering null on unique clauses
* Covering null on unique clauses
* Extract to utils
* Update settings to use subdomain path in team url , team + org
* Supporting having the orgId in the session cookie
* Onboarding admins step
* Last step to create teams
* Update handler comments
* Upgrade ORG banner - disabled team banner for child teams
* Handle publishing ORGS
* Fix licenese issue
* Update packages/trpc/server/routers/viewer/teams/create.handler.ts
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* A11ly
* Feedback
* Making an org avatar (temp)
* Add slug colission detection for user and team name
* Fix Import
* Remove update password func
* Fix module import over relative
* feat: organization event type filter (#9253)
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Missing changes to support orgs schema changes
* Remove app install button sa its in 9337
* Remove i18n key not being used
* feat: Onboarding process to create an organization (#9184)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Making sure we check requestedSlug now
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* feat: [CAL-1816] Organization subdomain support (#9345)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* Covering users and subteams, excluding non-org users
* Unpublished teams shows correctly
* Create subdomain in Vercel
* feedback
* Renaming Vercel env vars
* Vercel domain check before creation
* Supporting cal-staging.com
* Change to have vercel detect it
* vercel domain check data message error
* Remove check domain
* Making sure we check requestedSlug now
* Feedback and unneeded code
* Reverting unneeded changes
* Unneeded changes
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Vercel subdomain creation in PROD only
* feat: organization settings general and members page (#9266)
* feat: organization settings general page
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* feat: add members page
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* chore: remove
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: use invalidate
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: delete mutation
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: remove organization id
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* chore
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: use zod schema
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Type fixes
* Reverting changes
* Update UsernameTextfield.tsx
* More reverts
* Update next-auth-options.ts
* Update common.json
* Type fixes
* Include invite token for orgs
* Update org schema
* Make token settings optional as it isnt used in orgs yet
* Fix missing prop
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
Co-authored-by: Leo Giovanetti <hello@leog.me>
Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
Co-authored-by: zomars <zomars@me.com>
Co-authored-by: Hariom Balhara <hariombalhara@gmail.com>
2023-06-15 17:27:39 +00:00
|
|
|
<VerticalTabItem
|
2023-08-02 19:09:43 +00:00
|
|
|
name={t("appearance")}
|
|
|
|
href={`/settings/teams/${team.id}/appearance`}
|
feat: Org settings - profile,appearance, child teams, create new child (#9231)
* Initial commit
* Adding feature flag
* Desktop first banner, mobile pending
* Removing dead code and img
* AppInstallButtonBase
* WIP
* Adds Email verification template+translations for organizations (#9202)
* feat: Orgs Schema Changing `scopedMembers` to `orgUsers` (#9209)
* Change scopedMembers to orgMembers
* Change to orgUsers
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Session logic to show org label
* Step 2 done, avatar not working
* List orgs and list teams specific if orgs exist
* Conditionally show org - fix settings layout - add labels for all pages
* Profile Page + update
* Org specific team creation
* appearance page
* Ensure members cant of org cant update settings in UI
* Fix update handler imports
* hide billing on sub teams
* Update profile slug page
* Letting duplicate slugs for teams to support orgs
* Add slug coliisions for org
* Covering null on unique clauses
* Covering null on unique clauses
* Extract to utils
* Update settings to use subdomain path in team url , team + org
* Supporting having the orgId in the session cookie
* Onboarding admins step
* Last step to create teams
* Update handler comments
* Upgrade ORG banner - disabled team banner for child teams
* Handle publishing ORGS
* Fix licenese issue
* Update packages/trpc/server/routers/viewer/teams/create.handler.ts
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* A11ly
* Feedback
* Making an org avatar (temp)
* Add slug colission detection for user and team name
* Fix Import
* Remove update password func
* Fix module import over relative
* feat: organization event type filter (#9253)
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Missing changes to support orgs schema changes
* Remove app install button sa its in 9337
* Remove i18n key not being used
* feat: Onboarding process to create an organization (#9184)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Making sure we check requestedSlug now
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* feat: [CAL-1816] Organization subdomain support (#9345)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* Covering users and subteams, excluding non-org users
* Unpublished teams shows correctly
* Create subdomain in Vercel
* feedback
* Renaming Vercel env vars
* Vercel domain check before creation
* Supporting cal-staging.com
* Change to have vercel detect it
* vercel domain check data message error
* Remove check domain
* Making sure we check requestedSlug now
* Feedback and unneeded code
* Reverting unneeded changes
* Unneeded changes
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Vercel subdomain creation in PROD only
* feat: organization settings general and members page (#9266)
* feat: organization settings general page
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* feat: add members page
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* chore: remove
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: use invalidate
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: delete mutation
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: remove organization id
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* chore
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: use zod schema
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Type fixes
* Reverting changes
* Update UsernameTextfield.tsx
* More reverts
* Update next-auth-options.ts
* Update common.json
* Type fixes
* Include invite token for orgs
* Update org schema
* Make token settings optional as it isnt used in orgs yet
* Fix missing prop
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
Co-authored-by: Leo Giovanetti <hello@leog.me>
Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
Co-authored-by: zomars <zomars@me.com>
Co-authored-by: Hariom Balhara <hariombalhara@gmail.com>
2023-06-15 17:27:39 +00:00
|
|
|
textClassNames="px-3 text-emphasis font-medium text-sm"
|
|
|
|
disableChevron
|
|
|
|
/>
|
2023-08-02 19:09:43 +00:00
|
|
|
{/* Hide if there is a parent ID */}
|
|
|
|
{!team.parentId ? (
|
|
|
|
<>
|
|
|
|
<VerticalTabItem
|
|
|
|
name={t("billing")}
|
|
|
|
href={`/settings/teams/${team.id}/billing`}
|
|
|
|
textClassNames="px-3 text-emphasis font-medium text-sm"
|
|
|
|
disableChevron
|
|
|
|
/>
|
|
|
|
{HOSTED_CAL_FEATURES && (
|
|
|
|
<VerticalTabItem
|
|
|
|
name={t("saml_config")}
|
|
|
|
href={`/settings/teams/${team.id}/sso`}
|
|
|
|
textClassNames="px-3 text-emphasis font-medium text-sm"
|
|
|
|
disableChevron
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
</>
|
|
|
|
) : null}
|
feat: Org settings - profile,appearance, child teams, create new child (#9231)
* Initial commit
* Adding feature flag
* Desktop first banner, mobile pending
* Removing dead code and img
* AppInstallButtonBase
* WIP
* Adds Email verification template+translations for organizations (#9202)
* feat: Orgs Schema Changing `scopedMembers` to `orgUsers` (#9209)
* Change scopedMembers to orgMembers
* Change to orgUsers
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Session logic to show org label
* Step 2 done, avatar not working
* List orgs and list teams specific if orgs exist
* Conditionally show org - fix settings layout - add labels for all pages
* Profile Page + update
* Org specific team creation
* appearance page
* Ensure members cant of org cant update settings in UI
* Fix update handler imports
* hide billing on sub teams
* Update profile slug page
* Letting duplicate slugs for teams to support orgs
* Add slug coliisions for org
* Covering null on unique clauses
* Covering null on unique clauses
* Extract to utils
* Update settings to use subdomain path in team url , team + org
* Supporting having the orgId in the session cookie
* Onboarding admins step
* Last step to create teams
* Update handler comments
* Upgrade ORG banner - disabled team banner for child teams
* Handle publishing ORGS
* Fix licenese issue
* Update packages/trpc/server/routers/viewer/teams/create.handler.ts
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* A11ly
* Feedback
* Making an org avatar (temp)
* Add slug colission detection for user and team name
* Fix Import
* Remove update password func
* Fix module import over relative
* feat: organization event type filter (#9253)
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Missing changes to support orgs schema changes
* Remove app install button sa its in 9337
* Remove i18n key not being used
* feat: Onboarding process to create an organization (#9184)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* feedback
* Making sure we check requestedSlug now
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* feat: [CAL-1816] Organization subdomain support (#9345)
* Desktop first banner, mobile pending
* Removing dead code and img
* WIP
* Adds Email verification template+translations for organizations (#9202)
* First step done
* Merge branch 'feat/organizations-onboarding' of github.com:calcom/cal.com into feat/organizations-onboarding
* Step 2 done, avatar not working
* Covering null on unique clauses
* Onboarding admins step
* Last step to create teams
* Moving change password handler, improving verifying code flow
* Clearing error before submitting
* Reverting email testing api changes
* Reverting having the banner for now
* Consistent exported components
* Remove unneeded files from banner
* Removing uneeded code
* Fixing avatar selector
* Using meta component for head/descr
* Missing i18n strings
* Feedback
* Making an org avatar (temp)
* Check for subteams slug clashes with usernames
* Fixing create teams onsuccess
* Covering users and subteams, excluding non-org users
* Unpublished teams shows correctly
* Create subdomain in Vercel
* feedback
* Renaming Vercel env vars
* Vercel domain check before creation
* Supporting cal-staging.com
* Change to have vercel detect it
* vercel domain check data message error
* Remove check domain
* Making sure we check requestedSlug now
* Feedback and unneeded code
* Reverting unneeded changes
* Unneeded changes
---------
Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
* Vercel subdomain creation in PROD only
* feat: organization settings general and members page (#9266)
* feat: organization settings general page
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* feat: add members page
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* chore: remove
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: use invalidate
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: delete mutation
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: remove organization id
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* chore
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* fix: use zod schema
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
* Type fixes
* Reverting changes
* Update UsernameTextfield.tsx
* More reverts
* Update next-auth-options.ts
* Update common.json
* Type fixes
* Include invite token for orgs
* Update org schema
* Make token settings optional as it isnt used in orgs yet
* Fix missing prop
---------
Signed-off-by: Udit Takkar <udit.07814802719@cse.mait.ac.in>
Co-authored-by: Leo Giovanetti <hello@leog.me>
Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
Co-authored-by: zomars <zomars@me.com>
Co-authored-by: Hariom Balhara <hariombalhara@gmail.com>
2023-06-15 17:27:39 +00:00
|
|
|
</>
|
2023-08-02 19:09:43 +00:00
|
|
|
)}
|
|
|
|
</CollapsibleContent>
|
|
|
|
</Collapsible>
|
|
|
|
);
|
|
|
|
})}
|
|
|
|
{(!currentOrg || (currentOrg && currentOrg?.user?.role !== "MEMBER")) && (
|
|
|
|
<VerticalTabItem
|
|
|
|
name={t("add_a_team")}
|
|
|
|
href={`${WEBAPP_URL}/settings/teams/new`}
|
|
|
|
textClassNames="px-3 items-center mt-2 text-emphasis font-medium text-sm"
|
|
|
|
icon={Plus}
|
|
|
|
disableChevron
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
</React.Fragment>
|
|
|
|
)}
|
|
|
|
|
|
|
|
{tab.name === "other_teams" && (
|
|
|
|
<React.Fragment key={tab.href}>
|
|
|
|
<div className={`${!tab.children?.length ? "mb-3" : ""}`}>
|
|
|
|
<Link href={tab.href}>
|
|
|
|
<div className="hover:bg-subtle [&[aria-current='page']]:bg-emphasis [&[aria-current='page']]:text-emphasis group-hover:text-default text-default group flex h-9 w-full flex-row items-center rounded-md px-2 py-[10px] text-sm font-medium leading-none">
|
|
|
|
{tab && tab.icon && (
|
|
|
|
<tab.icon className="h-[16px] w-[16px] stroke-[2px] ltr:mr-3 rtl:ml-3 md:mt-0" />
|
|
|
|
)}
|
|
|
|
<Skeleton
|
|
|
|
title={t("org_admin_other_teams")}
|
|
|
|
as="p"
|
|
|
|
className="truncate text-sm font-medium leading-5"
|
|
|
|
loadingClassName="ms-3">
|
|
|
|
{t("org_admin_other_teams")}
|
|
|
|
</Skeleton>
|
|
|
|
</div>
|
|
|
|
</Link>
|
|
|
|
{otherTeams &&
|
|
|
|
otherTeamMenuState &&
|
|
|
|
otherTeams.map((otherTeam, index: number) => {
|
|
|
|
if (!otherTeamMenuState[index]) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
if (otherTeamMenuState.some((teamState) => teamState.teamId === otherTeam.id))
|
|
|
|
return (
|
|
|
|
<Collapsible
|
|
|
|
className="cursor-pointer"
|
|
|
|
key={otherTeam.id}
|
|
|
|
open={otherTeamMenuState[index].teamMenuOpen}
|
|
|
|
onOpenChange={() =>
|
|
|
|
setOtherTeamMenuState([
|
|
|
|
...otherTeamMenuState,
|
|
|
|
(otherTeamMenuState[index] = {
|
|
|
|
...otherTeamMenuState[index],
|
|
|
|
teamMenuOpen: !otherTeamMenuState[index].teamMenuOpen,
|
|
|
|
}),
|
|
|
|
])
|
|
|
|
}>
|
|
|
|
<CollapsibleTrigger asChild>
|
|
|
|
<div
|
|
|
|
className="hover:bg-subtle [&[aria-current='page']]:bg-emphasis [&[aria-current='page']]:text-emphasis text-default flex h-9 w-full flex-row items-center rounded-md px-3 py-[10px] text-left text-sm font-medium leading-none"
|
|
|
|
onClick={() =>
|
|
|
|
setOtherTeamMenuState([
|
|
|
|
...otherTeamMenuState,
|
|
|
|
(otherTeamMenuState[index] = {
|
|
|
|
...otherTeamMenuState[index],
|
|
|
|
teamMenuOpen: !otherTeamMenuState[index].teamMenuOpen,
|
|
|
|
}),
|
|
|
|
])
|
|
|
|
}>
|
|
|
|
<div className="me-3">
|
|
|
|
{otherTeamMenuState[index].teamMenuOpen ? (
|
|
|
|
<ChevronDown className="h-4 w-4" />
|
|
|
|
) : (
|
|
|
|
<ChevronRight className="h-4 w-4" />
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
<img
|
|
|
|
src={getPlaceholderAvatar(otherTeam.logo, otherTeam?.name as string)}
|
|
|
|
className="h-[16px] w-[16px] self-start rounded-full stroke-[2px] ltr:mr-2 rtl:ml-2 md:mt-0"
|
|
|
|
alt={otherTeam.name || "Team logo"}
|
|
|
|
/>
|
|
|
|
<p className="w-1/2 truncate">{otherTeam.name}</p>
|
2023-08-18 21:10:17 +00:00
|
|
|
{!otherTeam.accepted && otherTeam.userId === session.data?.user.id && (
|
2023-08-02 19:09:43 +00:00
|
|
|
<Badge className="ms-3" variant="orange">
|
|
|
|
Inv.
|
|
|
|
</Badge>
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
</CollapsibleTrigger>
|
|
|
|
<CollapsibleContent className="space-y-0.5">
|
2023-08-18 21:10:17 +00:00
|
|
|
{((otherTeam.accepted && otherTeam.userId === session.data?.user.id) ||
|
|
|
|
isOrgAdminOrOwner) && (
|
2023-08-02 19:09:43 +00:00
|
|
|
<VerticalTabItem
|
|
|
|
name={t("profile")}
|
|
|
|
href={`/settings/organizations/teams/other/${otherTeam.id}/profile`}
|
|
|
|
textClassNames="px-3 text-emphasis font-medium text-sm"
|
|
|
|
disableChevron
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
<VerticalTabItem
|
|
|
|
name={t("members")}
|
|
|
|
href={`/settings/organizations/teams/other/${otherTeam.id}/members`}
|
|
|
|
textClassNames="px-3 text-emphasis font-medium text-sm"
|
|
|
|
disableChevron
|
|
|
|
/>
|
|
|
|
|
|
|
|
<>
|
|
|
|
{/* TODO: enable appearance edit */}
|
|
|
|
{/* <VerticalTabItem
|
|
|
|
name={t("appearance")}
|
|
|
|
href={`/settings/organizations/teams/other/${otherTeam.id}/appearance`}
|
|
|
|
textClassNames="px-3 text-emphasis font-medium text-sm"
|
|
|
|
disableChevron
|
|
|
|
/> */}
|
|
|
|
</>
|
|
|
|
</CollapsibleContent>
|
|
|
|
</Collapsible>
|
|
|
|
);
|
|
|
|
})}
|
|
|
|
</div>
|
|
|
|
</React.Fragment>
|
|
|
|
)}
|
2023-08-18 22:50:44 +00:00
|
|
|
</React.Fragment>
|
2022-09-12 20:26:42 +00:00
|
|
|
);
|
|
|
|
})}
|
|
|
|
</>
|
|
|
|
</nav>
|
2022-09-07 01:33:50 +00:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
const MobileSettingsContainer = (props: { onSideContainerOpen?: () => void }) => {
|
|
|
|
const { t } = useLocale();
|
2023-02-25 19:07:41 +00:00
|
|
|
const router = useRouter();
|
2022-09-07 01:33:50 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
2023-04-16 20:18:56 +00:00
|
|
|
<nav className="bg-muted border-muted sticky top-0 z-20 flex w-full items-center justify-between border-b py-2 sm:relative lg:hidden">
|
2022-09-08 17:34:13 +00:00
|
|
|
<div className="flex items-center space-x-3 ">
|
2023-04-12 15:26:31 +00:00
|
|
|
<Button StartIcon={Menu} color="minimal" variant="icon" onClick={props.onSideContainerOpen}>
|
2022-12-19 17:37:20 +00:00
|
|
|
<span className="sr-only">{t("show_navigation")}</span>
|
|
|
|
</Button>
|
|
|
|
|
2023-02-25 19:07:41 +00:00
|
|
|
<button
|
2023-04-05 18:14:46 +00:00
|
|
|
className="hover:bg-emphasis flex items-center space-x-2 rounded-md px-3 py-1 rtl:space-x-reverse"
|
2023-02-25 19:07:41 +00:00
|
|
|
onClick={() => router.back()}>
|
2023-04-20 22:33:49 +00:00
|
|
|
<ArrowLeft className="text-default h-4 w-4" />
|
2023-04-05 18:14:46 +00:00
|
|
|
<p className="text-emphasis font-semibold">{t("settings")}</p>
|
2023-02-25 19:07:41 +00:00
|
|
|
</button>
|
2022-09-07 01:33:50 +00:00
|
|
|
</div>
|
|
|
|
</nav>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2022-08-09 09:21:15 +00:00
|
|
|
export default function SettingsLayout({
|
|
|
|
children,
|
|
|
|
...rest
|
|
|
|
}: { children: React.ReactNode } & ComponentProps<typeof Shell>) {
|
2023-08-02 09:35:48 +00:00
|
|
|
const pathname = usePathname();
|
2022-09-07 01:33:50 +00:00
|
|
|
const state = useState(false);
|
2022-12-19 17:37:20 +00:00
|
|
|
const { t } = useLocale();
|
2022-09-07 01:33:50 +00:00
|
|
|
const [sideContainerOpen, setSideContainerOpen] = state;
|
2022-09-26 19:09:51 +00:00
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
const closeSideContainer = () => {
|
|
|
|
if (window.innerWidth >= 1024) {
|
|
|
|
setSideContainerOpen(false);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
window.addEventListener("resize", closeSideContainer);
|
|
|
|
return () => {
|
|
|
|
window.removeEventListener("resize", closeSideContainer);
|
|
|
|
};
|
|
|
|
}, []);
|
|
|
|
|
2022-10-13 15:50:08 +00:00
|
|
|
useEffect(() => {
|
|
|
|
if (sideContainerOpen) {
|
|
|
|
setSideContainerOpen(!sideContainerOpen);
|
|
|
|
}
|
2023-08-02 09:35:48 +00:00
|
|
|
}, [pathname]);
|
2022-10-13 15:50:08 +00:00
|
|
|
|
2022-08-09 09:21:15 +00:00
|
|
|
return (
|
2022-09-06 19:34:58 +00:00
|
|
|
<Shell
|
2022-12-07 20:53:44 +00:00
|
|
|
withoutSeo={true}
|
2022-09-06 19:34:58 +00:00
|
|
|
flexChildrenContainer
|
2023-04-19 20:17:54 +00:00
|
|
|
hideHeadingOnMobile
|
2022-09-06 19:34:58 +00:00
|
|
|
{...rest}
|
2022-12-19 17:37:20 +00:00
|
|
|
SidebarContainer={
|
2023-07-31 18:51:08 +00:00
|
|
|
<SidebarContainerElement
|
|
|
|
sideContainerOpen={sideContainerOpen}
|
|
|
|
setSideContainerOpen={setSideContainerOpen}
|
|
|
|
/>
|
2022-12-19 17:37:20 +00:00
|
|
|
}
|
2022-09-07 01:33:50 +00:00
|
|
|
drawerState={state}
|
|
|
|
MobileNavigationContainer={null}
|
|
|
|
TopNavContainer={
|
|
|
|
<MobileSettingsContainer onSideContainerOpen={() => setSideContainerOpen(!sideContainerOpen)} />
|
2022-09-06 19:34:58 +00:00
|
|
|
}>
|
2022-09-07 01:33:50 +00:00
|
|
|
<div className="flex flex-1 [&>*]:flex-1">
|
2023-07-19 19:45:13 +00:00
|
|
|
<div className="mx-auto max-w-full justify-center md:max-w-4xl">
|
2022-09-07 01:33:50 +00:00
|
|
|
<ShellHeader />
|
2023-04-15 00:04:48 +00:00
|
|
|
<ErrorBoundary>
|
|
|
|
<Suspense fallback={<Loader />}>{children}</Suspense>
|
|
|
|
</ErrorBoundary>
|
2022-09-07 01:33:50 +00:00
|
|
|
</div>
|
2022-08-30 19:46:52 +00:00
|
|
|
</div>
|
2022-08-09 09:21:15 +00:00
|
|
|
</Shell>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2023-07-31 18:51:08 +00:00
|
|
|
const SidebarContainerElement = ({
|
|
|
|
sideContainerOpen,
|
|
|
|
bannersHeight,
|
|
|
|
setSideContainerOpen,
|
|
|
|
}: SidebarContainerElementProps) => {
|
|
|
|
const { t } = useLocale();
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
{/* Mobile backdrop */}
|
|
|
|
{sideContainerOpen && (
|
|
|
|
<button
|
|
|
|
onClick={() => setSideContainerOpen(false)}
|
|
|
|
className="fixed left-0 top-0 z-10 h-full w-full bg-black/50">
|
|
|
|
<span className="sr-only">{t("hide_navigation")}</span>
|
|
|
|
</button>
|
|
|
|
)}
|
|
|
|
<SettingsSidebarContainer
|
|
|
|
navigationIsOpenedOnMobile={sideContainerOpen}
|
|
|
|
bannersHeight={bannersHeight}
|
|
|
|
/>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
type SidebarContainerElementProps = {
|
|
|
|
sideContainerOpen: boolean;
|
|
|
|
bannersHeight?: number;
|
|
|
|
setSideContainerOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
|
|
|
};
|
|
|
|
|
2022-08-09 09:21:15 +00:00
|
|
|
export const getLayout = (page: React.ReactElement) => <SettingsLayout>{page}</SettingsLayout>;
|
2022-08-30 19:46:52 +00:00
|
|
|
|
|
|
|
function ShellHeader() {
|
|
|
|
const { meta } = useMeta();
|
|
|
|
const { t, isLocaleReady } = useLocale();
|
|
|
|
return (
|
2022-12-19 17:37:20 +00:00
|
|
|
<header className="mx-auto block justify-between pt-8 sm:flex">
|
2023-04-05 18:14:46 +00:00
|
|
|
<div className="border-subtle mb-8 flex w-full items-center border-b pb-6">
|
2022-09-12 19:07:52 +00:00
|
|
|
{meta.backButton && (
|
|
|
|
<a href="javascript:history.back()">
|
2023-04-12 15:26:31 +00:00
|
|
|
<ArrowLeft className="mr-7" />
|
2022-09-12 19:07:52 +00:00
|
|
|
</a>
|
2022-08-30 19:46:52 +00:00
|
|
|
)}
|
2022-09-12 19:07:52 +00:00
|
|
|
<div>
|
|
|
|
{meta.title && isLocaleReady ? (
|
2023-04-05 18:14:46 +00:00
|
|
|
<h1 className="font-cal text-emphasis mb-1 text-xl font-bold leading-5 tracking-wide">
|
2023-01-19 15:02:01 +00:00
|
|
|
{t(meta.title)}
|
|
|
|
</h1>
|
2022-09-12 19:07:52 +00:00
|
|
|
) : (
|
2023-07-04 23:41:29 +00:00
|
|
|
<div className="bg-emphasis mb-1 h-5 w-24 animate-pulse rounded-md" />
|
2022-09-12 19:07:52 +00:00
|
|
|
)}
|
|
|
|
{meta.description && isLocaleReady ? (
|
2023-04-05 18:14:46 +00:00
|
|
|
<p className="text-default text-sm ltr:mr-4 rtl:ml-4">{t(meta.description)}</p>
|
2022-09-12 19:07:52 +00:00
|
|
|
) : (
|
2023-07-04 23:41:29 +00:00
|
|
|
<div className="bg-emphasis h-5 w-32 animate-pulse rounded-md" />
|
2022-09-12 19:07:52 +00:00
|
|
|
)}
|
|
|
|
</div>
|
2023-04-09 09:13:57 +00:00
|
|
|
<div className="ms-auto flex-shrink-0">{meta.CTA}</div>
|
2022-08-30 19:46:52 +00:00
|
|
|
</div>
|
|
|
|
</header>
|
|
|
|
);
|
|
|
|
}
|