wcz-layout 6.7.2 → 9.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (275) hide show
  1. package/dist/Approval-C-hF4jbT.mjs +194 -0
  2. package/dist/Approval-C-hF4jbT.mjs.map +1 -0
  3. package/dist/DialogsContext-DLqA8RJ_.mjs +7 -0
  4. package/dist/DialogsContext-DLqA8RJ_.mjs.map +1 -0
  5. package/dist/Email-BzQQkbe9.mjs +20 -0
  6. package/dist/Email-BzQQkbe9.mjs.map +1 -0
  7. package/dist/Email-CKUxOURX.d.mts +17 -0
  8. package/dist/Employee-iepWeWhO.d.mts +363 -0
  9. package/dist/FileMeta-Be9viU7D.d.mts +19 -0
  10. package/dist/FileMeta-DDqUju1Y.mjs +19 -0
  11. package/dist/FileMeta-DDqUju1Y.mjs.map +1 -0
  12. package/dist/NotificationContext-CgwUOeW0.mjs +7 -0
  13. package/dist/NotificationContext-CgwUOeW0.mjs.map +1 -0
  14. package/dist/QueryClientParam-Cbb0MIKg.d.mts +10 -0
  15. package/dist/RouterListItemButton-owZVvuC_.mjs +78 -0
  16. package/dist/RouterListItemButton-owZVvuC_.mjs.map +1 -0
  17. package/dist/User-1gKoYJvW.d.mts +12 -0
  18. package/dist/auth.d.mts +19 -0
  19. package/dist/auth.mjs +92 -0
  20. package/dist/auth.mjs.map +1 -0
  21. package/dist/authMiddleware-CKD6lG9v.mjs +49 -0
  22. package/dist/authMiddleware-CKD6lG9v.mjs.map +1 -0
  23. package/dist/components.d.mts +104 -0
  24. package/dist/components.mjs +1277 -0
  25. package/dist/components.mjs.map +1 -0
  26. package/dist/data/client.d.mts +3202 -0
  27. package/dist/data/client.mjs +211 -0
  28. package/dist/data/client.mjs.map +1 -0
  29. package/dist/data/server.d.mts +10 -0
  30. package/dist/data/server.mjs +16 -0
  31. package/dist/data/server.mjs.map +1 -0
  32. package/dist/entra-47nBhMK-.mjs +109 -0
  33. package/dist/entra-47nBhMK-.mjs.map +1 -0
  34. package/dist/env-CoveIivr.mjs +30 -0
  35. package/dist/env-CoveIivr.mjs.map +1 -0
  36. package/dist/file-Bcoxn1YA.mjs +154 -0
  37. package/dist/file-Bcoxn1YA.mjs.map +1 -0
  38. package/dist/file-DgooCXxX.mjs +171 -0
  39. package/dist/file-DgooCXxX.mjs.map +1 -0
  40. package/dist/hooks.d.mts +215 -0
  41. package/dist/hooks.mjs +1090 -0
  42. package/dist/hooks.mjs.map +1 -0
  43. package/dist/index.d.mts +50 -0
  44. package/dist/index.mjs +1951 -0
  45. package/dist/index.mjs.map +1 -0
  46. package/dist/middleware.d.mts +33 -0
  47. package/dist/middleware.mjs +27 -0
  48. package/dist/middleware.mjs.map +1 -0
  49. package/dist/models.d.mts +225 -0
  50. package/dist/models.mjs +74 -0
  51. package/dist/models.mjs.map +1 -0
  52. package/dist/msalServer-Ce9p7sTC.mjs +30 -0
  53. package/dist/msalServer-Ce9p7sTC.mjs.map +1 -0
  54. package/dist/peoplesoft-4pOmhLn5.d.mts +167 -0
  55. package/dist/peoplesoft-BdPHe6Ac.mjs +202 -0
  56. package/dist/peoplesoft-BdPHe6Ac.mjs.map +1 -0
  57. package/dist/useDialogs-BUzVrTSP.mjs +248 -0
  58. package/dist/useDialogs-BUzVrTSP.mjs.map +1 -0
  59. package/dist/user-Dzv0N9fj.d.mts +16 -0
  60. package/dist/utils-5x4uNxsX.d.mts +63 -0
  61. package/dist/utils-CqVAK5F8.mjs +238 -0
  62. package/dist/utils-CqVAK5F8.mjs.map +1 -0
  63. package/dist/utils-D39-w_ij.mjs +4 -0
  64. package/dist/utils.d.mts +5 -0
  65. package/dist/utils.mjs +3 -0
  66. package/dist/vite.d.mts +6 -0
  67. package/dist/vite.mjs +149 -0
  68. package/dist/vite.mjs.map +1 -0
  69. package/package.json +127 -62
  70. package/skills/client-db/SKILL.md +109 -0
  71. package/skills/data-grid/SKILL.md +142 -0
  72. package/skills/db-schema/SKILL.md +72 -0
  73. package/skills/dialogs/SKILL.md +78 -0
  74. package/skills/forms/SKILL.md +83 -0
  75. package/skills/general/SKILL.md +74 -0
  76. package/skills/routing/SKILL.md +94 -0
  77. package/skills/server-functions/SKILL.md +111 -0
  78. package/skills/services/SKILL.md +31 -0
  79. package/skills/services/docs/approval.md +257 -0
  80. package/skills/services/docs/email.md +32 -0
  81. package/skills/services/docs/file.md +108 -0
  82. package/skills/services/docs/peoplesoft.md +110 -0
  83. package/skills/start/SKILL.md +47 -0
  84. package/skills/start/steps/01-git-setup.md +11 -0
  85. package/skills/start/steps/02-project-name-setup.md +19 -0
  86. package/skills/start/steps/03-apm-setup.md +208 -0
  87. package/skills/start/steps/04-wicop-setup.md +80 -0
  88. package/skills/start/steps/05-database-setup.md +44 -0
  89. package/skills/start/steps/06-entra-setup.md +98 -0
  90. package/skills/start/steps/07-vault-setup.md +69 -0
  91. package/skills/start/steps/08-generate-favicon.md +8 -0
  92. package/skills/start/steps/09-commit.md +15 -0
  93. package/skills/start/steps/10-gitlab-ci.md +25 -0
  94. package/dist/src/components/Layout.d.ts +0 -16
  95. package/dist/src/components/Layout.js +0 -122
  96. package/dist/src/components/Layout.js.map +0 -1
  97. package/dist/src/components/dataGrid/ChipInputCell.d.ts +0 -9
  98. package/dist/src/components/dataGrid/ChipInputCell.js +0 -17
  99. package/dist/src/components/dataGrid/ChipInputCell.js.map +0 -1
  100. package/dist/src/components/dataGrid/EditableColumnHeader.d.ts +0 -2
  101. package/dist/src/components/dataGrid/EditableColumnHeader.js +0 -7
  102. package/dist/src/components/dataGrid/EditableColumnHeader.js.map +0 -1
  103. package/dist/src/components/dataGrid/GridToolbar.d.ts +0 -8
  104. package/dist/src/components/dataGrid/GridToolbar.js +0 -40
  105. package/dist/src/components/dataGrid/GridToolbar.js.map +0 -1
  106. package/dist/src/components/dataGrid/TableContainer.d.ts +0 -3
  107. package/dist/src/components/dataGrid/TableContainer.js +0 -32
  108. package/dist/src/components/dataGrid/TableContainer.js.map +0 -1
  109. package/dist/src/components/form/FormAutocomplete.d.ts +0 -7
  110. package/dist/src/components/form/FormAutocomplete.js +0 -10
  111. package/dist/src/components/form/FormAutocomplete.js.map +0 -1
  112. package/dist/src/components/form/FormCheckbox.d.ts +0 -7
  113. package/dist/src/components/form/FormCheckbox.js +0 -11
  114. package/dist/src/components/form/FormCheckbox.js.map +0 -1
  115. package/dist/src/components/form/FormDatePicker.d.ts +0 -9
  116. package/dist/src/components/form/FormDatePicker.js +0 -19
  117. package/dist/src/components/form/FormDatePicker.js.map +0 -1
  118. package/dist/src/components/form/FormDateTimePicker.d.ts +0 -9
  119. package/dist/src/components/form/FormDateTimePicker.js +0 -19
  120. package/dist/src/components/form/FormDateTimePicker.js.map +0 -1
  121. package/dist/src/components/form/FormNumberField.d.ts +0 -12
  122. package/dist/src/components/form/FormNumberField.js +0 -12
  123. package/dist/src/components/form/FormNumberField.js.map +0 -1
  124. package/dist/src/components/form/FormRadioGroup.d.ts +0 -13
  125. package/dist/src/components/form/FormRadioGroup.js +0 -11
  126. package/dist/src/components/form/FormRadioGroup.js.map +0 -1
  127. package/dist/src/components/form/FormSlider.d.ts +0 -7
  128. package/dist/src/components/form/FormSlider.js +0 -11
  129. package/dist/src/components/form/FormSlider.js.map +0 -1
  130. package/dist/src/components/form/FormSubmitButton.d.ts +0 -5
  131. package/dist/src/components/form/FormSubmitButton.js +0 -13
  132. package/dist/src/components/form/FormSubmitButton.js.map +0 -1
  133. package/dist/src/components/form/FormSwitch.d.ts +0 -7
  134. package/dist/src/components/form/FormSwitch.js +0 -11
  135. package/dist/src/components/form/FormSwitch.js.map +0 -1
  136. package/dist/src/components/form/FormTextField.d.ts +0 -7
  137. package/dist/src/components/form/FormTextField.js +0 -11
  138. package/dist/src/components/form/FormTextField.js.map +0 -1
  139. package/dist/src/components/layout/AccountMenu.d.ts +0 -9
  140. package/dist/src/components/layout/AccountMenu.js +0 -44
  141. package/dist/src/components/layout/AccountMenu.js.map +0 -1
  142. package/dist/src/components/layout/DevelopmentBanner.d.ts +0 -7
  143. package/dist/src/components/layout/DevelopmentBanner.js +0 -29
  144. package/dist/src/components/layout/DevelopmentBanner.js.map +0 -1
  145. package/dist/src/components/layout/ErrorPage.d.ts +0 -2
  146. package/dist/src/components/layout/ErrorPage.js +0 -25
  147. package/dist/src/components/layout/ErrorPage.js.map +0 -1
  148. package/dist/src/components/layout/LayoutDialog.d.ts +0 -12
  149. package/dist/src/components/layout/LayoutDialog.js +0 -12
  150. package/dist/src/components/layout/LayoutDialog.js.map +0 -1
  151. package/dist/src/components/layout/LayoutSnackbar.d.ts +0 -8
  152. package/dist/src/components/layout/LayoutSnackbar.js +0 -25
  153. package/dist/src/components/layout/LayoutSnackbar.js.map +0 -1
  154. package/dist/src/components/layout/NavigationDrawer.d.ts +0 -11
  155. package/dist/src/components/layout/NavigationDrawer.js +0 -70
  156. package/dist/src/components/layout/NavigationDrawer.js.map +0 -1
  157. package/dist/src/components/layout/NotificationMenu.d.ts +0 -8
  158. package/dist/src/components/layout/NotificationMenu.js +0 -26
  159. package/dist/src/components/layout/NotificationMenu.js.map +0 -1
  160. package/dist/src/components/layout/TypographyWithIcon.d.ts +0 -7
  161. package/dist/src/components/layout/TypographyWithIcon.js +0 -22
  162. package/dist/src/components/layout/TypographyWithIcon.js.map +0 -1
  163. package/dist/src/components/layout/Unauthorized.d.ts +0 -2
  164. package/dist/src/components/layout/Unauthorized.js +0 -26
  165. package/dist/src/components/layout/Unauthorized.js.map +0 -1
  166. package/dist/src/contexts/LayoutContext.d.ts +0 -40
  167. package/dist/src/contexts/LayoutContext.js +0 -60
  168. package/dist/src/contexts/LayoutContext.js.map +0 -1
  169. package/dist/src/contexts/UserContext.d.ts +0 -24
  170. package/dist/src/contexts/UserContext.js +0 -55
  171. package/dist/src/contexts/UserContext.js.map +0 -1
  172. package/dist/src/hooks/FormHooks.d.ts +0 -46
  173. package/dist/src/hooks/FormHooks.js +0 -31
  174. package/dist/src/hooks/FormHooks.js.map +0 -1
  175. package/dist/src/hooks/UseSnackbar.d.ts +0 -10
  176. package/dist/src/hooks/UseSnackbar.js +0 -23
  177. package/dist/src/hooks/UseSnackbar.js.map +0 -1
  178. package/dist/src/hooks/UseUser.d.ts +0 -10
  179. package/dist/src/hooks/UseUser.js +0 -25
  180. package/dist/src/hooks/UseUser.js.map +0 -1
  181. package/dist/src/index.d.ts +0 -20
  182. package/dist/src/index.js +0 -15
  183. package/dist/src/index.js.map +0 -1
  184. package/dist/src/models/Error.d.ts +0 -6
  185. package/dist/src/models/Error.js +0 -2
  186. package/dist/src/models/Error.js.map +0 -1
  187. package/dist/src/models/KeycloakSettings.d.ts +0 -8
  188. package/dist/src/models/KeycloakSettings.js +0 -2
  189. package/dist/src/models/KeycloakSettings.js.map +0 -1
  190. package/dist/src/models/LayoutPaletteColorOptions.d.ts +0 -6
  191. package/dist/src/models/LayoutPaletteColorOptions.js +0 -2
  192. package/dist/src/models/LayoutPaletteColorOptions.js.map +0 -1
  193. package/dist/src/models/LayoutRoute.d.ts +0 -14
  194. package/dist/src/models/LayoutRoute.js +0 -2
  195. package/dist/src/models/LayoutRoute.js.map +0 -1
  196. package/dist/src/models/Notification.d.ts +0 -9
  197. package/dist/src/models/Notification.js +0 -2
  198. package/dist/src/models/Notification.js.map +0 -1
  199. package/dist/src/models/PeoplesoftDepartment.d.ts +0 -14
  200. package/dist/src/models/PeoplesoftDepartment.js +0 -2
  201. package/dist/src/models/PeoplesoftDepartment.js.map +0 -1
  202. package/dist/src/models/PeoplesoftEmployee.d.ts +0 -34
  203. package/dist/src/models/PeoplesoftEmployee.js +0 -2
  204. package/dist/src/models/PeoplesoftEmployee.js.map +0 -1
  205. package/dist/src/models/Snackbar.d.ts +0 -15
  206. package/dist/src/models/Snackbar.js +0 -2
  207. package/dist/src/models/Snackbar.js.map +0 -1
  208. package/dist/src/models/User.d.ts +0 -27
  209. package/dist/src/models/User.js +0 -11
  210. package/dist/src/models/User.js.map +0 -1
  211. package/dist/src/models/types/EmployeeCategoryGroup.d.ts +0 -1
  212. package/dist/src/models/types/EmployeeCategoryGroup.js +0 -2
  213. package/dist/src/models/types/EmployeeCategoryGroup.js.map +0 -1
  214. package/dist/src/models/types/EmployeeStatus.d.ts +0 -1
  215. package/dist/src/models/types/EmployeeStatus.js +0 -2
  216. package/dist/src/models/types/EmployeeStatus.js.map +0 -1
  217. package/dist/src/utils/Auth.d.ts +0 -12
  218. package/dist/src/utils/Auth.js +0 -49
  219. package/dist/src/utils/Auth.js.map +0 -1
  220. package/dist/src/utils/Fetches.d.ts +0 -5
  221. package/dist/src/utils/Fetches.js +0 -66
  222. package/dist/src/utils/Fetches.js.map +0 -1
  223. package/dist/src/utils/FormUtils.d.ts +0 -7
  224. package/dist/src/utils/FormUtils.js +0 -9
  225. package/dist/src/utils/FormUtils.js.map +0 -1
  226. package/dist/src/utils/Helpers.d.ts +0 -11
  227. package/dist/src/utils/Helpers.js +0 -26
  228. package/dist/src/utils/Helpers.js.map +0 -1
  229. package/dist/tsconfig.tsbuildinfo +0 -1
  230. package/src/components/Layout.tsx +0 -183
  231. package/src/components/dataGrid/ChipInputCell.tsx +0 -31
  232. package/src/components/dataGrid/EditableColumnHeader.tsx +0 -7
  233. package/src/components/dataGrid/GridToolbar.tsx +0 -63
  234. package/src/components/dataGrid/TableContainer.tsx +0 -39
  235. package/src/components/form/FormAutocomplete.tsx +0 -34
  236. package/src/components/form/FormCheckbox.tsx +0 -32
  237. package/src/components/form/FormDatePicker.tsx +0 -34
  238. package/src/components/form/FormDateTimePicker.tsx +0 -34
  239. package/src/components/form/FormNumberField.tsx +0 -33
  240. package/src/components/form/FormRadioGroup.tsx +0 -43
  241. package/src/components/form/FormSlider.tsx +0 -28
  242. package/src/components/form/FormSubmitButton.tsx +0 -29
  243. package/src/components/form/FormSwitch.tsx +0 -32
  244. package/src/components/form/FormTextField.tsx +0 -26
  245. package/src/components/layout/AccountMenu.tsx +0 -160
  246. package/src/components/layout/DevelopmentBanner.tsx +0 -54
  247. package/src/components/layout/ErrorPage.tsx +0 -34
  248. package/src/components/layout/LayoutDialog.tsx +0 -50
  249. package/src/components/layout/LayoutSnackbar.tsx +0 -44
  250. package/src/components/layout/NavigationDrawer.tsx +0 -131
  251. package/src/components/layout/NotificationMenu.tsx +0 -76
  252. package/src/components/layout/TypographyWithIcon.tsx +0 -35
  253. package/src/components/layout/Unauthorized.tsx +0 -37
  254. package/src/contexts/LayoutContext.tsx +0 -127
  255. package/src/contexts/UserContext.tsx +0 -88
  256. package/src/hooks/FormHooks.ts +0 -33
  257. package/src/hooks/UseSnackbar.tsx +0 -28
  258. package/src/hooks/UseUser.tsx +0 -29
  259. package/src/index.ts +0 -27
  260. package/src/models/Error.tsx +0 -6
  261. package/src/models/KeycloakSettings.ts +0 -8
  262. package/src/models/LayoutPaletteColorOptions.tsx +0 -7
  263. package/src/models/LayoutRoute.ts +0 -15
  264. package/src/models/Notification.ts +0 -10
  265. package/src/models/PeoplesoftDepartment.ts +0 -15
  266. package/src/models/PeoplesoftEmployee.ts +0 -35
  267. package/src/models/Snackbar.ts +0 -16
  268. package/src/models/User.ts +0 -13
  269. package/src/models/types/EmployeeCategoryGroup.ts +0 -1
  270. package/src/models/types/EmployeeStatus.ts +0 -1
  271. package/src/utils/Auth.ts +0 -58
  272. package/src/utils/Fetches.ts +0 -83
  273. package/src/utils/FormUtils.ts +0 -22
  274. package/src/utils/Helpers.ts +0 -27
  275. package/tsconfig.json +0 -29
@@ -0,0 +1,72 @@
1
+ ---
2
+ name: db-schema
3
+ description: "Use when: defining or updating Drizzle ORM table schemas, relations, enums, migrations, or Zod schemas derived from database models."
4
+ ---
5
+
6
+ # Database Schema Patterns
7
+
8
+ ## Rules
9
+
10
+ - Always use `uuid` for primary keys, and `snakeCase` for generating tables.
11
+ - For `uuid` columns, do not generate random values in the schema. Client should generate UUIDs when creating new records.
12
+ - Always add `withTimezone: true` to timestamp columns.
13
+ - Always add `onDelete: "cascade"` on foreign keys for child/dependent tables.
14
+ - Define relations in a central `relations.ts` file.
15
+ - Generate Zod schemas with `createSelectSchema`; override fields with stricter rules (trim, min/max) where needed.
16
+ - Use `.transform()` on all Zod schemas that include related data to assign parent IDs.
17
+ - Do not auto-generate migrations unless the user explicitly asks. When asked, run `npm run db:generate`; migrations apply automatically at app startup while `DATABASE_AUTO_MIGRATE=true`.
18
+ - Export enums from the schema file and reference enumValues everywhere else — never re-declare the values.
19
+
20
+ ## File Placement
21
+
22
+ ```
23
+ drizzle-orm - defineRelations utility
24
+ drizzle-orm/pg-core - snakeCase table builder and column types
25
+ drizzle-orm/zod - createSelectSchema
26
+ zod - Zod
27
+ src/server/db/schemas/ - Drizzle table schemas and relations
28
+ src/server/db/migrations/ - Drizzle migration files
29
+ src/lib/schemas/ - Zod schemas (shared between client and server)
30
+ wcz-layout/utils - `t` translation function
31
+ ```
32
+
33
+ ## Examples
34
+
35
+ ```ts
36
+ // src/server/db/schemas/<feature>.ts
37
+ export const bookTable = snakeCase.table("books", {
38
+ id: uuid().primaryKey(),
39
+ title: text().notNull(),
40
+ libraryId: uuid()
41
+ .notNull()
42
+ .references(() => libraryTable.id, { onDelete: "cascade" }),
43
+ });
44
+
45
+ // src/server/db/schemas/relations.ts
46
+ export const relations = defineRelations(
47
+ { libraryTable, bookTable },
48
+ ({ one, many, libraryTable: library, bookTable: book }) => ({
49
+ libraryTable: {
50
+ books: many.bookTable(),
51
+ },
52
+ bookTable: {
53
+ library: one.libraryTable({ from: book.libraryId, to: library.id }),
54
+ },
55
+ }),
56
+ );
57
+
58
+ // src/lib/schemas/<feature>.ts
59
+ export const BookSchema = createSelectSchema(bookTable, {
60
+ title: (schema) =>
61
+ schema
62
+ .trim()
63
+ .min(1, t("Validation.Required"))
64
+ .max(255, t("Validation.MaxLength", { length: 255 })),
65
+ pages: PageSchema.array().min(1, t("Validation.Required")),
66
+ }).transform((data) => ({
67
+ ...data,
68
+ pages: data.pages.map((page) => ({ ...page, bookId: data.id })),
69
+ }));
70
+
71
+ export type Book = z.infer<typeof BookSchema>;
72
+ ```
@@ -0,0 +1,78 @@
1
+ ---
2
+ name: dialogs
3
+ description: "Use when: creating or modifying alert, confirm, or custom dialogs."
4
+ ---
5
+
6
+ ## Rules
7
+
8
+ - Always use `useDialogs()` for modal interactions.
9
+ - Use `confirm()` for destructive or user-confirmed actions.
10
+ - Use `alert()` for informational or error messages that require acknowledgement.
11
+ - Use `open()` for feature-specific custom dialogs with typed payloads.
12
+ - Custom dialogs must receive `DialogProps<T>`.
13
+ - Keep dialogs colocated inside `routes/feature/-components` when feature-specific.
14
+ - Always use translation; add new keys for feature-specific messages.
15
+
16
+ ## File Placement
17
+
18
+ ```txt
19
+ src/components/dialogs/ — shared dialogs used across features
20
+ src/routes/<feature>s/-components/ — feature-scoped dialogs
21
+ wcz-layout/hooks — useDialogs hook, DialogProps type, useTranslation
22
+ src/lib/locales/ — translation keys
23
+ @mui/material — MUI Dialog components
24
+ ```
25
+
26
+ ## Examples
27
+
28
+ ```ts
29
+ // confirmation dialog
30
+ const { confirm } = useDialogs();
31
+ const { t } = useTranslation();
32
+
33
+ const confirmed = await confirm(t("DeleteConfirmation", { count: selectedIds.length }));
34
+ if (confirmed) await deleteFeature({ data: id });
35
+
36
+ // alert dialog
37
+ const { alert } = useDialogs();
38
+ const { t } = useTranslation();
39
+
40
+ try {
41
+ await saveFeature(values);
42
+ await alert(t("FeatureSavedSuccessfully"));
43
+ } catch (error) {
44
+ await alert(error instanceof Error ? error.message : t("UnknownError"));
45
+ }
46
+
47
+ // custom dialog
48
+ const { open } = useDialogs();
49
+
50
+ await open(EditFeatureDialog, { id });
51
+
52
+ // custom dialog component
53
+ interface Payload {
54
+ id: string;
55
+ }
56
+
57
+ export const EditFeatureDialog = ({
58
+ payload,
59
+ open,
60
+ onClose,
61
+ }: DialogProps<Payload>) => {
62
+ const { t } = useTranslation();
63
+
64
+ return (
65
+ <Dialog fullWidth open={open} onClose={() => onClose()}>
66
+ <DialogTitle>{t("EditFeature")}</DialogTitle>
67
+ <DialogContent>
68
+ {payload.id}
69
+ </DialogContent>
70
+ <DialogActions>
71
+ <Button onClick={() => onClose()}>
72
+ Close
73
+ </Button>
74
+ </DialogActions>
75
+ </Dialog>
76
+ );
77
+ };
78
+ ```
@@ -0,0 +1,83 @@
1
+ ---
2
+ name: forms
3
+ description: "Use when: creating or modifying TanStack Form components, field layouts, validation schemas, submit handling, or custom form controls."
4
+ ---
5
+
6
+ # Form Patterns
7
+
8
+ ## Rules
9
+
10
+ - Always use `useLayoutForm` with pre-defined components.
11
+ - Define `width` for all form fields based on the expected content length.
12
+ - Reuse Zod schemas from `src/lib/schemas/` which are derived from Drizzle schemas with `createSelectSchema` from table schemas.
13
+ - Use translation for labels, helper text, validation messages and submit.
14
+ - Reset the form after successful create.
15
+ - Use one of the following field based on the use case: `Autocomplete`, `Checkbox`, `DatePicker`, `DateRangePicker`, `DateTimePicker`, `DateTimeRangePicker`, `NumberField`, `RadioGroup`, `Slider`, `SubmitButton`, `Switch`, `TextField`, `TimePicker`, or `TimeRangePicker`.
16
+ - When fetching data for a form, always use a suspense query.
17
+
18
+ ## File Placement
19
+
20
+ ```
21
+ src/routes/<feature>s/-components/ - route-scoped forms
22
+ src/lib/schemas/ — Zod schemas (shared between client and server)
23
+ wcz-layout/hooks - useLayoutForm hook, useTranslation
24
+ ```
25
+
26
+ ## Examples
27
+
28
+ ```ts
29
+ // Form Component
30
+ interface FormProps {
31
+ defaultValues: Feature;
32
+ onSubmit: (value: Feature) => Promise<void>;
33
+ }
34
+
35
+ export const Form: FC<FormProps> = ({ defaultValues, onSubmit }) => {
36
+ const { t } = useTranslation();
37
+
38
+ const form = useLayoutForm({
39
+ defaultValues,
40
+ validators: { onChange: FeatureSchema },
41
+ onSubmit: async ({ value, formApi }) => {
42
+ await onSubmit(value);
43
+ formApi.reset();
44
+ },
45
+ });
46
+
47
+ return (
48
+ <form
49
+ onSubmit={(event) => {
50
+ event.preventDefault();
51
+ event.stopPropagation();
52
+ form.handleSubmit();
53
+ }}
54
+ >
55
+ {/* some styling */}
56
+ <form.AppField name="name">
57
+ {(field) => <field.TextField label={t("Feature.Name")} required sx={{ width: 420 }} />}
58
+ </form.AppField>
59
+ {/* some styling */}
60
+ <form.AppForm>
61
+ <form.SubmitButton variant="contained">{t("Submit")}</form.SubmitButton>
62
+ </form.AppForm>
63
+ </form>
64
+ );
65
+ };
66
+
67
+ // Autocomplete
68
+ <field.Autocomplete
69
+ options={options}
70
+ sx={{ width: 250 }}
71
+ autoHighlight
72
+ autoSelect
73
+ autoComplete
74
+ loading={isLoading}
75
+ textFieldProps={{
76
+ label: t("Customer"),
77
+ required: true,
78
+ }}
79
+ />
80
+
81
+ // Checkbox
82
+ <field.Checkbox label={t("IsThisTrue")} />
83
+ ```
@@ -0,0 +1,74 @@
1
+ ---
2
+ name: general
3
+ description: "Use ALWAYS for project-wide conventions and coding standards. It defines the default style, rules, and best practices that apply to every file and feature."
4
+ ---
5
+
6
+ > This is the default skill. Reference it in combination with more specific skills (e.g., `forms`, `data-grid`, `dialogs`) for targeted tasks.
7
+
8
+ ## Preferred Technology Stack
9
+
10
+ Favor the established platform before introducing custom code or a new dependency:
11
+
12
+ - **TanStack ecosystem:** Use TanStack Start, Router, DB, Form, and Query for their respective application concerns. Consider adjacent TanStack libraries when they directly fit the feature: TanStack AI for AI interactions, TanStack Virtual for large virtualized lists, TanStack Pacer for debouncing, throttling, rate limiting, queuing, and batching, and TanStack Hotkeys for type-safe keyboard shortcuts.
13
+ - **Vite+:** Use Vite+ for the development server, build tooling, and project integration.
14
+ - **Material UI:** Use Material UI for interface components and icons. When an advanced capability is needed, consider MUI X Charts for data visualization, Tree View for hierarchical data, Scheduler for calendars and timelines, and Chat for AI-powered conversations.
15
+
16
+ Before implementing an external library feature, consult the current documentation through Context7 MCP. Do not add a dependency when one of these platform libraries already covers the requirement.
17
+
18
+ ## Coding Conventions
19
+
20
+ - Generate modern ES6+ TypeScript with explicit types and never use `any`.
21
+ - Stick to double quotes, semicolons, and the `~/` alias for `src/` imports.
22
+ - Avoid `useMemo` / `useCallback`; the React Compiler handles memoization.
23
+ - Keep code self-documenting; only add comments to clarify non-obvious intent.
24
+
25
+ ## User Interface
26
+
27
+ - Format all client-side dates with `"L LT"` or `"L"`.
28
+ - Build skeletons for loading states.
29
+ - When building UI, always design for both light and dark mode; this app uses `colorSchemeSelector: "data-mui-color-scheme"`, so prefer `theme.applyStyles("dark", ...)` for mode-specific styling.
30
+
31
+ ## File Organization
32
+
33
+ Use this ownership model for new application code. Keep feature-specific code close to its route; promote it to a root directory only when it is shared across multiple features.
34
+
35
+ ```txt
36
+ src/ # client-first architecture
37
+ ├── components/ # shared components across multiple routes
38
+ ├── db-collections/ # TanStack DB collections
39
+ ├── hooks/ # shared hooks across multiple routes
40
+ ├── lib/ # isomorphic/shared logic usable by client and server
41
+ │ ├── auth/
42
+ │ │ ├── permissions.ts
43
+ │ │ └── scopes.ts
44
+ │ ├── locales/
45
+ │ │ ├── cs.json
46
+ │ │ └── en.json
47
+ │ └── schemas/ # shared Zod schemas
48
+ ├── routes/ # TanStack Router file-based routing
49
+ │ ├── __root.tsx
50
+ │ ├── index.tsx
51
+ │ └── features/ # route group with multiple pages
52
+ │ ├── -components/ # route-specific components
53
+ │ ├── -hooks/ # route-specific hooks
54
+ │ ├── index.tsx
55
+ │ ├── create.tsx
56
+ │ ├── edit.$id.tsx
57
+ │ └── $id.tsx
58
+ ├── server/ # server-only code
59
+ │ ├── actions/
60
+ │ │ └── feature.ts
61
+ │ ├── db/
62
+ │ │ ├── migrations/
63
+ │ │ ├── schemas/ # Drizzle schemas
64
+ │ │ │ └── feature.ts
65
+ │ │ └── index.ts
66
+ │ └── middleware/
67
+ │ └── databaseMiddleware.ts
68
+ └── types/
69
+ ```
70
+
71
+ ## Development And Validation
72
+
73
+ - Use only port 3000 for local development browser access.
74
+ - Do not build the application for routine validation; it is slow. Check TypeScript errors instead.
@@ -0,0 +1,94 @@
1
+ ---
2
+ name: routing
3
+ description: "Use when: creating or modifying TanStack Router routes, navigation, permissions, loaders, etc."
4
+ ---
5
+
6
+ > Mechanics (`createFileRoute`, `beforeLoad`, `redirect`, `loader`, preloading, `pendingComponent`) are covered by TanStack's own skills — load `@tanstack/router-core#router-core/auth-and-guards`, `#router-core/data-loading`, and `#router-core/navigation` for the API details. This skill adds only the wcz-layout conventions on top.
7
+
8
+ ## Rules
9
+
10
+ - Include the `requirePermission(<permissionKey>)` function in the route's `beforeLoad` to enforce access control — pass a key defined in your app's `src/lib/auth/permissions.ts`; omit it only for intentionally public routes.
11
+ - Use `Route.useRouteContext()` to access the authenticated user. User can be `null` if the route doesn't include `requirePermission`.
12
+ - Use the route `loader` option to preload db collections. Preload only collections with `eager` syncMode.
13
+ - Create a `pendingComponent` for routes that suspend or preload meaningful data.
14
+ - Route names must always be kebab-case. Entity route names must always be plural.
15
+ - If a feature contains only one route, create a single file route: `src/routes/libraries.tsx`
16
+ - If a feature contains multiple related routes, create a folder: `src/routes/libraries/index.tsx`
17
+ - Colocate route-specific components/hooks inside `routes/<feature>/-components` or `-hooks`.
18
+ - Root-level `components/` and `hooks/` are only for code shared across multiple routes.
19
+ - After creating a new route, add or ask for a navigation item with a unique icon from `@mui/icons-material` in `src/routes/__root.tsx`.
20
+ - For navigation and redirects, always use the type-safe router components from `wcz-layout/components` (`RouterButton`, `RouterIconButton`, `RouterLink`, `RouterFab`, `RouterTab`, `RouterListItemButton`, `RouterGridActionsCellItem`) rather than raw MUI with a manual `href` — they wrap `createLink`, so `to`/`params`/`search` are type-checked.
21
+
22
+ ## Examples
23
+
24
+ ```ts
25
+ // imports
26
+ import { useDialogs, useTranslation } from "wcz-layout/hooks";
27
+ import { requirePermission, uuidv7 } from "wcz-layout/utils";
28
+
29
+ // src/routes/features/create.tsx
30
+ export const Route = createFileRoute("/features/create")({
31
+ component: RouteComponent,
32
+ beforeLoad: requirePermission("admin"),
33
+ pendingComponent: FeatureSkeleton,
34
+ loader: () => {
35
+ featureCollection.preload();
36
+ },
37
+ });
38
+
39
+ function RouteComponent() {
40
+ const { t } = useTranslation();
41
+ const { alert, confirm } = useDialogs();
42
+ const { user } = Route.useRouteContext();
43
+ // route component code...
44
+ }
45
+
46
+ // __root.tsx
47
+ import { hasPermission } from "wcz-layout/utils";
48
+
49
+ const { user } = Route.useRouteContext();
50
+
51
+ const navigation: Navigation = [
52
+ {
53
+ kind: "item",
54
+ to: "/",
55
+ title: "Home",
56
+ icon: <Home />,
57
+ hidden: !hasPermission(user, "all"),
58
+ },
59
+ {
60
+ kind: "header",
61
+ title: "Documentation",
62
+ },
63
+ {
64
+ kind: "group",
65
+ title: "Components",
66
+ icon: <Widgets />,
67
+ children: [
68
+ {
69
+ kind: "item",
70
+ to: "/components/navigation",
71
+ title: "Navigation",
72
+ icon: <AccountTree />,
73
+ },
74
+ {
75
+ kind: "divider",
76
+ },
77
+ {
78
+ kind: "item",
79
+ to: "/components/forms",
80
+ title: "Forms",
81
+ icon: <Code />,
82
+ },
83
+ ],
84
+ },
85
+ ];
86
+
87
+ // Routes are public unless guarded. By convention, protect every route by adding
88
+ // requirePermission to its beforeLoad (omit only for intentionally public routes) —
89
+ // it redirects to login when signed out, then checks the permission group.
90
+ export const Route = createFileRoute("/feature-name")({
91
+ component: RouteComponent,
92
+ beforeLoad: requirePermission("admin"),
93
+ });
94
+ ```
@@ -0,0 +1,111 @@
1
+ ---
2
+ name: server-functions
3
+ description: "Use when: creating or modifying TanStack Start server functions, API routes or middleware."
4
+ ---
5
+
6
+ > Mechanics (`createServerFn`, `.validator`, `createMiddleware`, `createHandlers`) are covered by TanStack's own skills — load `@tanstack/start-client-core#start-core/server-functions`, `#start-core/middleware`, and `#start-core/server-routes` for the API details. This skill adds only the wcz-layout middleware conventions on top.
7
+
8
+ ## Rules
9
+
10
+ - Before generating code, clarify whether the feature should be exposed as public REST API routes or implemented as internal TanStack Start server functions (recommended), and what permission should be required for access.
11
+ - Every server function MUST include `authorizationMiddleware` — server functions are callable RPC endpoints, so a route-level `requirePermission` in `beforeLoad` only hides the UI and does not protect them.
12
+ - Follow the chain order for server functions: `middleware` → `validator` → `handler`.
13
+ - Follow the order for middleware arrays: `authorizationMiddleware(<permissionKey>)` → `databaseMiddleware()`.
14
+ - Use `validationMiddleware` only in REST API routes. Server functions use `.validator()`.
15
+ - `databaseMiddleware` wraps the handler in a DB transaction and sets `app.user_name` so audit triggers can record who made the change.
16
+ - Reuse schemas from `src/lib/schemas/`.
17
+
18
+ ## File Placement
19
+
20
+ ```
21
+ src/server/actions/ — server functions
22
+ src/routes/api/ — REST API routes
23
+ src/server/middleware/ — databaseMiddleware
24
+ wcz-layout/middleware/ — authorizationMiddleware, validationMiddleware
25
+ src/server/db/schemas/ — tables, enums, relations
26
+ src/lib/schemas/ — Zod schemas (shared between client and server)
27
+ src/lib/auth/permissions.ts — permission keys
28
+ ```
29
+
30
+ ## Examples
31
+
32
+ ```ts
33
+ // src/server/actions/<feature>.ts
34
+ export const selectFeatures = createServerFn()
35
+ .middleware([authorizationMiddleware("all"), databaseMiddleware()])
36
+ .handler(async ({ context }) => {
37
+ return await context.db.select().from(featureTable);
38
+ });
39
+
40
+ export const insertFeature = createServerFn({ method: "POST" })
41
+ .middleware([authorizationMiddleware("admin"), databaseMiddleware()])
42
+ .validator(FeatureSchema)
43
+ .handler(async ({ data, context }) => {
44
+ await context.db.insert(featureTable).values(data);
45
+ });
46
+
47
+ export const updateFeature = createServerFn({ method: "POST" })
48
+ .middleware([authorizationMiddleware("admin"), databaseMiddleware()])
49
+ .validator(FeatureSchema)
50
+ .handler(async ({ data, context }) => {
51
+ await context.db.update(featureTable).set(data).where(eq(featureTable.id, data.id));
52
+ });
53
+
54
+ export const deleteFeature = createServerFn({ method: "POST" })
55
+ .middleware([authorizationMiddleware("admin"), databaseMiddleware()])
56
+ .validator(FeatureSchema.pick({ id: true }))
57
+ .handler(async ({ data, context }) => {
58
+ await context.db.delete(featureTable).where(eq(featureTable.id, data.id));
59
+ });
60
+
61
+ // src/routes/api/<feature>s/index.ts
62
+ export const Route = createFileRoute("/api/features/")({
63
+ server: {
64
+ middleware: [databaseMiddleware()],
65
+ handlers: ({ createHandlers }) =>
66
+ createHandlers({
67
+ GET: {
68
+ middleware: [authorizationMiddleware("all")],
69
+ handler: async ({ context }) => {
70
+ const items = await context.db.select().from(featureTable);
71
+ return Response.json(items);
72
+ },
73
+ },
74
+ POST: {
75
+ middleware: [validationMiddleware(FeatureSchema), authorizationMiddleware("admin")],
76
+ handler: async ({ context }) => {
77
+ const [response] = await context.db
78
+ .insert(featureTable)
79
+ .values(context.data)
80
+ .returning();
81
+ return Response.json(response, { status: 201 });
82
+ },
83
+ },
84
+ }),
85
+ },
86
+ });
87
+
88
+ // src/routes/api/<feature>s/$id.ts
89
+ export const Route = createFileRoute("/api/features/$id")({
90
+ server: {
91
+ middleware: [authorizationMiddleware("admin"), databaseMiddleware()],
92
+ handlers: ({ createHandlers }) =>
93
+ createHandlers({
94
+ PUT: {
95
+ middleware: [validationMiddleware(FeatureSchema)],
96
+ handler: async ({ params, context }) => {
97
+ await context.db
98
+ .update(featureTable)
99
+ .set(context.data)
100
+ .where(eq(featureTable.id, params.id));
101
+ return new Response(null, { status: 204 });
102
+ },
103
+ },
104
+ DELETE: async ({ params, context }) => {
105
+ await context.db.delete(featureTable).where(eq(featureTable.id, params.id));
106
+ return new Response(null, { status: 204 });
107
+ },
108
+ }),
109
+ },
110
+ });
111
+ ```
@@ -0,0 +1,31 @@
1
+ ---
2
+ name: services
3
+ description: "Use when: working with file, approval, employee or email services into your workflow."
4
+ ---
5
+
6
+ ## Info
7
+
8
+ You can read about each service in the links below. Services are categorized as either client or server exports, depending on their intended usage.
9
+
10
+ - **Client exports** — Contains `queryOptions` and `mutationOptions`; use for data fetching/mutations on the client with React Query.
11
+ - **Server exports** — Server functions; prefer calling mutations inside other server functions or database transactions.
12
+ - Invalidating mutation options take `{ queryClient }` so they can invalidate related queries; read-only ones (e.g. `downloadFileMutationOptions()`, `openFileMutationOptions()`) don't require it.
13
+ - Access `queryClient` with `Route.useRouteContext()` in a route file, or `useRouteContext({ from: "path" })` in a component.
14
+ - To read about a service, open the linked file in the **File** column directly.
15
+
16
+ ## Import Paths
17
+
18
+ - Client exports: `wcz-layout/data/client`
19
+ - Server exports: `wcz-layout/data/server`
20
+ - Schemas & Models: `wcz-layout/models`
21
+
22
+ ## Services
23
+
24
+ | Service | File | Summary |
25
+ | ---------- | ----------------------------------- | ----------------------------------------------------------------------- |
26
+ | file | [file.md](docs/file.md) | File metadata, thumbnails, binary download/open, upload, update, delete |
27
+ | approval | [approval.md](docs/approval.md) | Approval request lifecycle, approvers, flows, statuses, step results |
28
+ | peoplesoft | [peoplesoft.md](docs/peoplesoft.md) | Employee, manager, department, and company general manager lookups |
29
+ | email | [email.md](docs/email.md) | Server-only email sending with optional file attachment references |
30
+
31
+ > The attendance service is not available yet — do not generate code against it; tell the user it is coming in a future release.