diff --git a/opensaas-sh/app_diff/src/file-upload/operations.ts.diff b/opensaas-sh/app_diff/src/file-upload/operations.ts.diff index d7a58ae..8d750e0 100644 --- a/opensaas-sh/app_diff/src/file-upload/operations.ts.diff +++ b/opensaas-sh/app_diff/src/file-upload/operations.ts.diff @@ -1,8 +1,8 @@ --- template/app/src/file-upload/operations.ts +++ opensaas-sh/app/src/file-upload/operations.ts -@@ -18,6 +18,18 @@ - throw new HttpError(401); - } +@@ -25,6 +25,18 @@ + + const { fileType, fileName } = ensureArgsSchemaOrThrowHttpError(createFileInputSchema, rawArgs); + const numberOfFilesByUser = await context.entities.File.count({ + where: { @@ -16,6 +16,6 @@ + throw new HttpError(403, 'Thanks for trying Open SaaS. This demo only allows 2 file uploads per user.'); + } + - const userInfo = context.user.id; - - const { uploadUrl, key } = await getUploadFileSignedURLFromS3({ fileType, userInfo }); + const { uploadUrl, key } = await getUploadFileSignedURLFromS3({ + fileType, + fileName, diff --git a/opensaas-sh/app_diff/src/payment/plans.ts.diff b/opensaas-sh/app_diff/src/payment/plans.ts.diff deleted file mode 100644 index a7cd30a..0000000 --- a/opensaas-sh/app_diff/src/payment/plans.ts.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- template/app/src/payment/plans.ts -+++ opensaas-sh/app/src/payment/plans.ts -@@ -9,7 +9,7 @@ - } - - export interface PaymentPlan { -- // Returns the id under which this payment plan is identified on your payment processor. -+ // Returns the id under which this payment plan is identified on your payment processor. - // E.g. this might be price id on Stripe, or variant id on LemonSqueezy. - getPaymentProcessorPlanId: () => string; - effect: PaymentPlanEffect; diff --git a/opensaas-sh/app_diff/src/user/operations.ts.diff b/opensaas-sh/app_diff/src/user/operations.ts.diff index bbaefb0..6341ac5 100644 --- a/opensaas-sh/app_diff/src/user/operations.ts.diff +++ b/opensaas-sh/app_diff/src/user/operations.ts.diff @@ -1,8 +1,8 @@ --- template/app/src/user/operations.ts +++ opensaas-sh/app/src/user/operations.ts -@@ -38,7 +38,10 @@ - subscriptionStatus?: SubscriptionStatus[]; +@@ -41,7 +41,10 @@ }; + type GetPaginatedUsersOutput = { - users: Pick[]; + users: Pick< @@ -12,28 +12,15 @@ totalPages: number; }; -@@ -51,8 +54,10 @@ - } - - const allSubscriptionStatusOptions = args.subscriptionStatus as Array | undefined; -- const hasNotSubscribed = allSubscriptionStatusOptions?.find((status) => status === null) -- let subscriptionStatusStrings = allSubscriptionStatusOptions?.filter((status) => status !== null) as string[] | undefined -+ const hasNotSubscribed = allSubscriptionStatusOptions?.find((status) => status === null); -+ let subscriptionStatusStrings = allSubscriptionStatusOptions?.filter((status) => status !== null) as -+ | string[] -+ | undefined; - - const queryResults = await context.entities.User.findMany({ - skip: args.skip, -@@ -65,6 +70,7 @@ +@@ -85,6 +88,7 @@ mode: 'insensitive', }, - isAdmin: args.isAdmin, + isAdmin, + isMockUser: true, }, { OR: [ -@@ -88,7 +94,7 @@ +@@ -108,7 +112,7 @@ username: true, isAdmin: true, subscriptionStatus: true, @@ -42,10 +29,10 @@ }, orderBy: { id: 'desc', -@@ -104,6 +110,7 @@ +@@ -124,6 +128,7 @@ mode: 'insensitive', }, - isAdmin: args.isAdmin, + isAdmin, + isMockUser: true, }, { diff --git a/template/app/src/admin/dashboards/users/UsersTable.tsx b/template/app/src/admin/dashboards/users/UsersTable.tsx index 4d1f4a8..7812443 100644 --- a/template/app/src/admin/dashboards/users/UsersTable.tsx +++ b/template/app/src/admin/dashboards/users/UsersTable.tsx @@ -7,9 +7,11 @@ import DropdownEditDelete from './DropdownEditDelete'; import { updateIsUserAdminById } from 'wasp/client/operations'; import { type User } from 'wasp/entities'; -const AdminSwitch = ({ id, isAdmin }: Pick) => { - return updateIsUserAdminById({ id: id, isAdmin: !isAdmin })} />; -}; +function AdminSwitch({ id, isAdmin }: Pick) { + return ( + updateIsUserAdminById({ id: id, isAdmin: value })} /> + ); +} const UsersTable = () => { const [currentPage, setCurrentPage] = useState(1); @@ -214,7 +216,7 @@ const UsersTable = () => { ); -}; +} function ChevronDownIcon() { return ( diff --git a/template/app/src/admin/elements/forms/FormElementsPage.tsx b/template/app/src/admin/elements/forms/FormElementsPage.tsx index 3debb5d..4676642 100644 --- a/template/app/src/admin/elements/forms/FormElementsPage.tsx +++ b/template/app/src/admin/elements/forms/FormElementsPage.tsx @@ -170,34 +170,7 @@ const FormElements = ({ user }: { user: AuthUser }) => {
- - - - - - - + - - - - - +
@@ -232,39 +190,13 @@ const FormElements = ({ user }: { user: AuthUser }) => { Design - - - + Development - - - + @@ -277,22 +209,7 @@ const FormElements = ({ user }: { user: AuthUser }) => { - - - - - + @@ -309,10 +226,65 @@ function SwitchExamples() { const [isSecondOn, setIsSecondOn] = useState(false); return (
- setIsFirstOn(!isFirstOn)} /> - setIsSecondOn(!isSecondOn)} /> + +
); } +function GlobeIcon() { + return ( + + + + + + + + ); +} + +function ChevronDownIcon() { + return ( + + + + + + ); +} + +function XIcon() { + return ( + + + + ); +} + export default FormElements; diff --git a/template/app/src/admin/elements/forms/SwitcherOne.tsx b/template/app/src/admin/elements/forms/SwitcherOne.tsx index fabf701..d2e321d 100644 --- a/template/app/src/admin/elements/forms/SwitcherOne.tsx +++ b/template/app/src/admin/elements/forms/SwitcherOne.tsx @@ -1,18 +1,14 @@ +import { useId } from 'react'; import { cn } from '../../../client/cn'; -import { ChangeEventHandler } from 'react'; -const SwitcherOne = ({ - isOn, - onChange, -}: { - isOn: boolean; - onChange: ChangeEventHandler; -}) => { +function SwitcherOne({ isOn, onChange }: { isOn: boolean; onChange: (value: boolean) => void }) { + const id = useId(); + return (
-