-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Design-System-Project/feature/tfr2-98-add-…
…design-system-project-selector-on-navigation-bar Add project selector on navigation bar
- Loading branch information
Showing
70 changed files
with
1,335 additions
and
3,680 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 14 additions & 5 deletions
19
...d/src/app/(dashboard)/integrations/providers/figma/resources/_actions/resources.action.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,28 @@ | ||
import { eq } from 'drizzle-orm'; | ||
import { database } from '@/lib/drizzle'; | ||
import { isAuthenticated } from '@/lib/supabase/server/utils/is-authenticated'; | ||
import { getDesignSystemId } from '@/lib/supabase/server/utils/get-design-system-id'; | ||
import { getProjectId } from '@/lib/supabase/server/utils/get-project-id'; | ||
|
||
export async function getResources() { | ||
if (!(await isAuthenticated())) { | ||
throw new Error('Not authenticated'); | ||
} | ||
|
||
const designSystemId = await getDesignSystemId(); | ||
const projectId = await getProjectId(); | ||
|
||
if (!designSystemId) | ||
throw new Error('No design system associated with this account'); | ||
if (!projectId) throw new Error('No project associated with this account'); | ||
|
||
return database.query.resourcesTable.findMany({ | ||
where: (resources) => eq(resources.designSystemId, designSystemId), | ||
with: { | ||
project: { | ||
with: { | ||
resources: true, | ||
accountsToProjects: { | ||
where: (accountsToProjects) => | ||
eq(accountsToProjects.projectId, projectId), | ||
}, | ||
}, | ||
}, | ||
}, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 10 additions & 11 deletions
21
apps/dashboard/src/app/api/figma/design-systems/list/route.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
apps/dashboard/src/components/navigation/_actions/get-projects.action.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
'use server'; | ||
|
||
import { eq } from 'drizzle-orm'; | ||
import { database } from '@/lib/drizzle'; | ||
import { getUserAccount } from '@/lib/supabase/server/utils/get-user-account'; | ||
import { isAuthenticated } from '@/lib/supabase/server/utils/is-authenticated'; | ||
|
||
export async function getProjects() { | ||
if (!(await isAuthenticated())) { | ||
throw new Error('Not authenticated'); | ||
} | ||
|
||
const account = await getUserAccount(); | ||
|
||
if (!account) { | ||
return undefined; | ||
} | ||
|
||
const projects = await database.query.projectsTable.findMany({ | ||
with: { | ||
accountsToProjects: { | ||
where: (accounts) => eq(accounts.accountId, account.id), | ||
}, | ||
}, | ||
}); | ||
|
||
return projects; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.