mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-12-04 22:31:33 +09:00
feat: Dashboard welcome state (#4765)
## Description The state for when user first signs up and has no projects <img width="859" alt="image" src="https://github.com/user-attachments/assets/e4ec0bfc-68a9-4df4-8004-923c4b449ac4" /> ## Steps for reproduction 1. click button 2. expect xyz ## Code Review - [ ] hi @kof, I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview ## Before requesting a review - [ ] made a self-review - [ ] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [ ] tested locally and on preview environment (preview dev login: 0000) - [ ] updated [test cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md) document - [ ] added tests - [ ] if any new env variables are added, added them to `.env` file
This commit is contained in:
1 parent
a556b6b2aa
commit
b3e2604ce7
9 files changed
+88
-43
No files matched your search
@@ -68,3 +68,30 @@ export const findManyByIds = async (
|
||||
| "marketplaceApprovalStatus"
|
||||
>[];
|
||||
};
|
||||
|
||||
export const hasAny = async (userId: string, context: AppContext) => {
|
||||
if (context.authorization.type !== "user") {
|
||||
throw new AuthorizationError(
|
||||
"Only logged in users can view the project list"
|
||||
);
|
||||
}
|
||||
|
||||
if (userId !== context.authorization.userId) {
|
||||
throw new AuthorizationError(
|
||||
"Only the project owner can view the project list"
|
||||
);
|
||||
}
|
||||
|
||||
const data = await context.postgrest.client
|
||||
.from("DashboardProject")
|
||||
.select("id")
|
||||
.limit(1)
|
||||
.eq("userId", userId)
|
||||
.eq("isDeleted", false);
|
||||
|
||||
if (data.error) {
|
||||
throw data.error;
|
||||
}
|
||||
|
||||
return data.data.length > 0;
|
||||
};
|
||||
@@ -10,24 +10,22 @@ import { db } from "../db";
|
||||
|
||||
const projectRouter = router({
|
||||
findMany: procedure
|
||||
.input(
|
||||
z.object({
|
||||
userId: z.string(),
|
||||
})
|
||||
)
|
||||
.input(z.object({ userId: z.string() }))
|
||||
.query(async ({ input, ctx }) => {
|
||||
return await db.findMany(input.userId, ctx);
|
||||
}),
|
||||
|
||||
findManyByIds: procedure
|
||||
.input(
|
||||
z.object({
|
||||
projectIds: z.array(z.string()),
|
||||
})
|
||||
)
|
||||
.input(z.object({ projectIds: z.array(z.string()) }))
|
||||
.query(async ({ input, ctx }) => {
|
||||
return await db.findManyByIds(input.projectIds, ctx);
|
||||
}),
|
||||
|
||||
hasAny: procedure
|
||||
.input(z.object({ userId: z.string() }))
|
||||
.query(async ({ input, ctx }) => {
|
||||
return await db.hasAny(input.userId, ctx);
|
||||
}),
|
||||
});
|
||||
|
||||
export const dashboardProjectRouter = mergeRouters(
|
||||
|
||||
Reference in new issue
Block a user