@propriety/court-calendar 0.0.0

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 (53) hide show
  1. package/.editorconfig +26 -0
  2. package/README.md +0 -0
  3. package/biome.json +302 -0
  4. package/dev/App.tsx +51 -0
  5. package/dev/main.tsx +10 -0
  6. package/index.html +12 -0
  7. package/package.json +54 -0
  8. package/public/vite.svg +1 -0
  9. package/src/_components/CCalendar.css +463 -0
  10. package/src/_components/CCalendar.tsx +726 -0
  11. package/src/_components/List/CalendarList.tsx +288 -0
  12. package/src/_components/Modal/CaseDetails/CaseDetails.tsx +414 -0
  13. package/src/_components/Modal/CaseDetails/EvidenceRow.tsx +83 -0
  14. package/src/_components/Modal/CaseDetails/EvidenceSection.tsx +94 -0
  15. package/src/_components/Modal/CreateEdit/CreateEditCase.tsx +241 -0
  16. package/src/_components/Modal/CreateEdit/DateSelector.tsx +42 -0
  17. package/src/_components/Modal/CreateEdit/EditUserFieldDropdown.tsx +54 -0
  18. package/src/_components/Modal/CreateEdit/EnumDropdown.tsx +54 -0
  19. package/src/_components/Modal/CreateEdit/HearingOfficerDropdown.tsx +48 -0
  20. package/src/_components/Modal/CreateEdit/TextFieldList.tsx +186 -0
  21. package/src/_components/Modal/CreateEdit/ToggleableTextField.tsx +91 -0
  22. package/src/_components/Modal/Modal.css +15 -0
  23. package/src/_components/Modal/Modal.tsx +325 -0
  24. package/src/_components/Modal/ModalActions.tsx +99 -0
  25. package/src/_components/Modal/View/CaseToolbar.tsx +81 -0
  26. package/src/_components/Modal/View/CaseViewer.tsx +237 -0
  27. package/src/_components/Modal/View/DateDetails.tsx +138 -0
  28. package/src/_components/Modal/View/InfoBox.tsx +22 -0
  29. package/src/_components/Modal/View/InfoBoxBtn.css +39 -0
  30. package/src/_components/Modal/View/InfoBoxBtn.tsx +29 -0
  31. package/src/_components/Modal/View/NoticeFileLink.tsx +44 -0
  32. package/src/_components/Shared/FirstSecondChairIcons.tsx +247 -0
  33. package/src/_components/Shared/FormRow.tsx +37 -0
  34. package/src/_components/Shared/MuniDropdown.tsx +94 -0
  35. package/src/_components/Shared/SearchBar.tsx +87 -0
  36. package/src/_components/Toolbar/CaseFilter.tsx +77 -0
  37. package/src/_components/Toolbar/DateTypeFilter.tsx +63 -0
  38. package/src/_components/Toolbar/HearingTypeFilter.tsx +63 -0
  39. package/src/_components/Toolbar/Toolbar.tsx +159 -0
  40. package/src/_components/Toolbar/UserFilter.tsx +105 -0
  41. package/src/_components/Toolbar/ViewFilter.tsx +48 -0
  42. package/src/helpers/cache.ts +89 -0
  43. package/src/helpers/cases.ts +79 -0
  44. package/src/helpers/courtDates.ts +139 -0
  45. package/src/helpers/formatter.ts +16 -0
  46. package/src/helpers/munis.ts +44 -0
  47. package/src/helpers/people.ts +46 -0
  48. package/src/index.ts +2 -0
  49. package/src/types.ts +129 -0
  50. package/tsconfig.app.json +32 -0
  51. package/tsconfig.json +4 -0
  52. package/tsconfig.node.json +30 -0
  53. package/vite.config.ts +27 -0
@@ -0,0 +1,46 @@
1
+ import type { User, HearingOfficer } from '../types';
2
+
3
+ async function getAllUsers(apiKey: string): Promise<Record<number, User>> {
4
+ if (!apiKey) return {};
5
+
6
+ const res = await fetch(`https://utils.aventine.ai/users/all`, {
7
+ mode: 'cors',
8
+ headers: {
9
+ 'x-api-key': apiKey,
10
+ },
11
+ });
12
+ const data = await res.json();
13
+ console.log('Fetched users:', data);
14
+ const users: Record<number, User> = {};
15
+ if (data == null || data.users == null) {
16
+ return users;
17
+ }
18
+ for (const user of data.users) {
19
+ users[user.UserID] = user;
20
+ }
21
+ return users;
22
+ }
23
+
24
+ async function getAllHearingOfficers(apiKey: string): Promise<Record<number, HearingOfficer>> {
25
+ if (!apiKey) return {};
26
+ const res = await fetch(`https://utils.aventine.ai/users/hearing-officers`, {
27
+ mode: 'cors',
28
+ headers: {
29
+ 'x-api-key': apiKey,
30
+ },
31
+ });
32
+ const data = await res.json();
33
+ console.log('Fetched hearing officers:', data);
34
+ const officers: Record<number, HearingOfficer> = {};
35
+ if (data == null || data.hearing_officers == null) {
36
+ return officers;
37
+ }
38
+ for (const officer of data.hearing_officers) {
39
+ officers[officer.OfficerID] = officer;
40
+ }
41
+ return officers;
42
+ }
43
+
44
+ export const allUsers = await getAllUsers(import.meta.env.VITE_CALENDAR_API_KEY);
45
+
46
+ export const allHearingOfficers = await getAllHearingOfficers(import.meta.env.VITE_CALENDAR_API_KEY);
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ // export stuff
2
+ export { default as CCalendar } from './_components/CCalendar';
package/src/types.ts ADDED
@@ -0,0 +1,129 @@
1
+ export interface CourtDate {
2
+ CourtDateID: number;
3
+ CourtDate: Date; //
4
+ MuniCode: string;
5
+ UploadDeadline: Date | null; //
6
+ CourtCases: number;
7
+ Lifecycle: Lifecycle | null; //
8
+
9
+ HearingTime: string;
10
+ HearingLink: string | null;
11
+ Source: SourceType | null; //
12
+ Type: HearingType | null; //
13
+
14
+ FirstChair: number | null; //
15
+ SecondChair: number | null; //
16
+ HearingOfficer: number | null;
17
+ EnterDate: Date;
18
+ LastUpdateDate: Date | null;
19
+ AdjournmentDate: Date | null; //
20
+ IsAdjourned: boolean;
21
+
22
+ Notes: string | null;
23
+ NoticeFile: string | null;
24
+ }
25
+
26
+ export enum SourceType {
27
+ MANUAL = 'manual',
28
+ EMAIL = 'email',
29
+ ETRACK = 'etrack',
30
+ }
31
+
32
+ export enum HearingType {
33
+ UNKNOWN = 'Other',
34
+ VIRTUAL = 'Virtual',
35
+ IN_PERSON = 'InPerson',
36
+ }
37
+
38
+ export enum Lifecycle {
39
+ ASSIGNED = 'Assigned',
40
+ UPLOADED = 'Uploaded',
41
+ SCHEDULED = 'Scheduled',
42
+ ADJOURNED = 'Adjourned',
43
+ }
44
+
45
+ export interface Muni {
46
+ County: string;
47
+ Township: string;
48
+ Village: string;
49
+ }
50
+
51
+ export interface CalendarFilterCtx {
52
+ // hearing type
53
+ showVirtual: boolean;
54
+ showInPerson: boolean;
55
+ showUnknown: boolean;
56
+ // other
57
+ showOnlyAssignedToUser: number | null;
58
+ showUploadDeadlines: boolean;
59
+ showAdjournmentDates: boolean;
60
+ showCourtDates: boolean;
61
+
62
+ // grouping filters
63
+ municode: string | null;
64
+ user: User | null;
65
+
66
+ // cases
67
+ showOnlyUnsettled: boolean;
68
+ showOnlyWithoutEvidence: boolean;
69
+ showOnlyUnreviewed: boolean;
70
+ searchTerm: string;
71
+ }
72
+
73
+ export interface Case {
74
+ ParcelID: string;
75
+ Municipality: string;
76
+ Negotiator: number;
77
+ Year: number;
78
+
79
+ property_data: Property;
80
+ evidence: Evidence | null;
81
+ DateCompleted: Date | null;
82
+
83
+ SCARIndexNumber: string;
84
+ SCARDeterminationAction: string;
85
+ SCARSettleDate: Date | null;
86
+ SCARFileDate: Date | null;
87
+
88
+ VillageSCARIndexNumber: string;
89
+ VillageSCARDeterminationAction: string;
90
+ VillageSCARSettleDate: Date | null;
91
+ VillageSCARFileDate: Date | null;
92
+ }
93
+
94
+ export interface Evidence {
95
+ CreatedDate: Date | null;
96
+ User: number | null;
97
+ Evidence: string;
98
+ ParcelID: string;
99
+ Year: number;
100
+ Uploaded: {
101
+ Evidence: string;
102
+ UploadDate: Date | null;
103
+ };
104
+ }
105
+
106
+ export interface Property {
107
+ Address: string;
108
+ PropertyOwnerFull: string;
109
+ }
110
+
111
+ export enum ModalMode {
112
+ DETAILS = 'Details',
113
+ EDIT = 'Edit',
114
+ CREATE = 'Create',
115
+ CASE_DETAILS = 'Case Details',
116
+ }
117
+
118
+ export interface User {
119
+ UserID: number;
120
+ UserFirstName: string;
121
+ UserLastName: string;
122
+ UserEmail: string;
123
+ Picture: string | null;
124
+ }
125
+
126
+ export interface HearingOfficer {
127
+ OfficerID: number;
128
+ OfficerName: string;
129
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "compilerOptions": {
3
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
4
+ "target": "ES2022",
5
+ "useDefineForClassFields": true,
6
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
7
+ "module": "ESNext",
8
+ "types": ["vite/client"],
9
+ "skipLibCheck": true,
10
+ "baseUrl": ".",
11
+ "paths": {
12
+ "@/*": ["./src/*"]
13
+ },
14
+
15
+ /* Bundler mode */
16
+ "moduleResolution": "bundler",
17
+ "allowImportingTsExtensions": true,
18
+ "verbatimModuleSyntax": true,
19
+ "moduleDetection": "force",
20
+ "noEmit": true,
21
+ "jsx": "react-jsx",
22
+
23
+ /* Linting */
24
+ "strict": true,
25
+ "noUnusedLocals": true,
26
+ "noUnusedParameters": true,
27
+ "erasableSyntaxOnly": false,
28
+ "noFallthroughCasesInSwitch": true,
29
+ "noUncheckedSideEffectImports": true
30
+ },
31
+ "include": ["src", "dev/main.tsx"]
32
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "files": [],
3
+ "references": [{ "path": "./tsconfig.app.json" }, { "path": "./tsconfig.node.json" }]
4
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "compilerOptions": {
3
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
4
+ "target": "ES2023",
5
+ "lib": ["ES2023"],
6
+ "module": "ESNext",
7
+ "types": ["node"],
8
+ "skipLibCheck": true,
9
+ "baseUrl": ".",
10
+ "paths": {
11
+ "@/*": ["./src/*"]
12
+ },
13
+
14
+ /* Bundler mode */
15
+ "moduleResolution": "bundler",
16
+ "allowImportingTsExtensions": true,
17
+ "verbatimModuleSyntax": true,
18
+ "moduleDetection": "force",
19
+ "noEmit": true,
20
+
21
+ /* Linting */
22
+ "strict": true,
23
+ "noUnusedLocals": true,
24
+ "noUnusedParameters": true,
25
+ "erasableSyntaxOnly": false,
26
+ "noFallthroughCasesInSwitch": true,
27
+ "noUncheckedSideEffectImports": true
28
+ },
29
+ "include": ["vite.config.ts"]
30
+ }
package/vite.config.ts ADDED
@@ -0,0 +1,27 @@
1
+ import { defineConfig } from 'vite';
2
+ import react from '@vitejs/plugin-react-swc';
3
+ import dts from 'vite-plugin-dts';
4
+ import { resolve } from 'path';
5
+
6
+ // https://vite.dev/config/
7
+ export default defineConfig({
8
+ plugins: [react(), dts({ include: ['src'] })],
9
+ build: {
10
+ lib: {
11
+ entry: resolve(__dirname, 'src/index.tsx'),
12
+ name: 'court-calendar',
13
+ fileName: (format) => `index.${format === 'es' ? 'mjs' : 'js'}`,
14
+ },
15
+ rollupOptions: {
16
+ external: ['react', 'react-dom'],
17
+ output: {
18
+ globals: { react: 'React', 'react-dom': 'ReactDOM' },
19
+ },
20
+ },
21
+ },
22
+ resolve: {
23
+ alias: {
24
+ '@': resolve(__dirname, './src/'),
25
+ },
26
+ },
27
+ });