File tree Expand file tree Collapse file tree 4 files changed +38
-18
lines changed
projects/[projectId]/settings Expand file tree Collapse file tree 4 files changed +38
-18
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import { PageLoading } from "@/components/core/loaders";
77import PermissionsManagement from "@/components/core/permissions-management" ;
88import PageSection from "@/components/core/section" ;
99import PageTitle from "@/components/layout/page-title" ;
10+ import { isPersonalTenant } from "@/lib/utils/useOwner" ;
1011import { useTRPC } from "@/trpc/client" ;
1112
1213export default function ProjectSettings ( ) {
@@ -21,7 +22,7 @@ export default function ProjectSettings() {
2122 } ) ,
2223 ) ;
2324
24- const isOrgAdmin = tenant === "me" ;
25+ const isOrgAdmin = isPersonalTenant ( tenant ) ;
2526
2627 if ( isLoading || ! project ) return < PageLoading /> ;
2728
Original file line number Diff line number Diff line change @@ -5,9 +5,17 @@ import { ProfileSettings } from "@/components/settings/profile-settings";
55import { TeamSettings } from "@/components/settings/team-settings" ;
66import { WorkspaceSettings } from "@/components/settings/workspace-settings" ;
77import { bytesToMegabytes } from "@/lib/blobStore" ;
8+ import { isPersonalTenant } from "@/lib/utils/useOwner" ;
89import { caller } from "@/trpc/server" ;
910
10- export default async function Settings ( ) {
11+ export default async function Settings ( {
12+ params,
13+ } : {
14+ params : Promise < { tenant : string } > ;
15+ } ) {
16+ const { tenant } = await params ;
17+ const isPersonal = isPersonalTenant ( tenant ) ;
18+
1119 const [ storage , timezone , projectsData ] = await Promise . all ( [
1220 caller . settings . getStorageUsage ( ) ,
1321 caller . settings . getTimezone ( ) ,
@@ -20,21 +28,25 @@ export default async function Settings() {
2028 < >
2129 < PageTitle title = "Settings" />
2230
23- < PageSection
24- title = "Workspace"
25- titleIcon = { < Building2 className = "w-5 h-5" /> }
26- bottomMargin
27- >
28- < WorkspaceSettings />
29- </ PageSection >
31+ { ! isPersonal && (
32+ < PageSection
33+ title = "Workspace"
34+ titleIcon = { < Building2 className = "w-5 h-5" /> }
35+ bottomMargin
36+ >
37+ < WorkspaceSettings />
38+ </ PageSection >
39+ ) }
3040
31- < PageSection
32- title = "Team"
33- titleIcon = { < Users className = "w-5 h-5" /> }
34- bottomMargin
35- >
36- < TeamSettings />
37- </ PageSection >
41+ { ! isPersonal && (
42+ < PageSection
43+ title = "Team"
44+ titleIcon = { < Users className = "w-5 h-5" /> }
45+ bottomMargin
46+ >
47+ < TeamSettings />
48+ </ PageSection >
49+ ) }
3850
3951 < PageSection
4052 title = "Usage"
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ import { Card } from "@/components/ui/card";
2727import { toDateStringWithDay } from "@/lib/utils/date" ;
2828import { displayMutationError } from "@/lib/utils/error" ;
2929import { eventToHumanReadableString } from "@/lib/utils/useEvents" ;
30+ import { isPersonalTenant } from "@/lib/utils/useOwner" ;
3031import { useTRPC } from "@/trpc/client" ;
3132
3233export default function Today ( ) {
@@ -52,7 +53,7 @@ export default function Today() {
5253 } ) ;
5354
5455 const projects = projectsData ?. projects ;
55- const isOrgAdmin = projectsData ?. isOrgAdmin ?? tenant === "me" ;
56+ const isOrgAdmin = projectsData ?. isOrgAdmin ?? isPersonalTenant ( tenant ) ;
5657
5758 const { dueToday = [ ] , overDue = [ ] , events = [ ] } = todayData ?? { } ;
5859
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ export async function getOwner(): Promise<Result> {
2424
2525 const activeOrgId = session . session . activeOrganizationId ;
2626
27- let orgSlug = "me" ;
27+ let orgSlug = PERSONAL_TENANT ;
2828 if ( activeOrgId ) {
2929 const db = database ( ) ;
3030 const org = await db
@@ -45,6 +45,12 @@ export async function getOwner(): Promise<Result> {
4545 } ;
4646}
4747
48+ export const PERSONAL_TENANT = "me" ;
49+
50+ export function isPersonalTenant ( tenant : string ) {
51+ return tenant === PERSONAL_TENANT ;
52+ }
53+
4854export async function getTimezone ( ) {
4955 const cookieStore = await cookies ( ) ;
5056 return (
You can’t perform that action at this time.
0 commit comments