-
Notifications
You must be signed in to change notification settings - Fork 0
feat(arc): add generic toggle button #205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces a generic toggle button component to replace resource-specific implementations, making it easier to add toggleable fields to different resources. The new ToggleButton component supports configurable states, icons, variants, and toast messages through resource metadata.
Key changes:
- Added type definitions for toggle configuration (
ToggleStateConfig,ToggleFieldConfig,ToggleToastMessages) - Implemented generic
ToggleButtoncomponent with flexible state management - Configured toggle functionality for NotificationTopics and StudentOrganizations resources
- Deprecated the old
ToggleOrganizationStatusButtoncomponent with migration guidance
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/features/resources/types/internal.ts |
Added TypeScript interfaces for toggle configuration (state config, toast messages, field config) |
src/features/resources/types/index.ts |
Exported new toggle-related types for public API |
src/features/resources/node.ts |
Exported toggle types for server-side usage |
src/features/resources/data/resource-metadata.ts |
Added toggle configurations for NotificationTopics and StudentOrganizations with Polish localization |
src/features/abstract-resource-collection/index.ts |
Exported new ToggleButton component |
src/features/abstract-resource-collection/components/toggle-button.tsx |
Implemented generic toggle button with state management, API integration, and toast notifications |
src/features/abstract-resource-collection/components/toggle-status-button.tsx |
Added deprecation notice with migration example |
src/features/abstract-resource-collection/components/arl-item.tsx |
Replaced specific toggle button with generic implementation using metadata configuration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/features/abstract-resource-collection/components/toggle-status-button.tsx
Outdated
Show resolved
Hide resolved
src/features/abstract-resource-collection/components/toggle-button.tsx
Outdated
Show resolved
Hide resolved
src/features/abstract-resource-collection/components/toggle-button.tsx
Outdated
Show resolved
Hide resolved
src/features/abstract-resource-collection/components/arl-item.tsx
Outdated
Show resolved
Hide resolved
src/features/abstract-resource-collection/components/toggle-button.tsx
Outdated
Show resolved
Hide resolved
src/features/abstract-resource-collection/components/toggle-status-button.tsx
Show resolved
Hide resolved
9afb24e to
e3d79c7
Compare
src/features/abstract-resource-collection/components/toggle-status-button.tsx
Outdated
Show resolved
Hide resolved
src/features/abstract-resource-collection/components/toggle-status-button.tsx
Outdated
Show resolved
Hide resolved
src/features/abstract-resource-collection/components/toggle-status-button.tsx
Outdated
Show resolved
Hide resolved
src/features/abstract-resource-collection/components/toggle-status-button.tsx
Outdated
Show resolved
Hide resolved
09bfd8c to
f0f114b
Compare
|
Z tego co zauważyłem testy nie przechodzą przez #213 |
| const fieldValue = getFieldValue( | ||
| body, | ||
| config.field as unknown as ResourceSchemaKey< | ||
| T, | ||
| z.ZodString | z.ZodNumber | ||
| >, | ||
| ) as unknown; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nie mam pomysłu jak to inaczej rozwiązać bez błędu typów
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
niech pole "field" będzie w deklaracji configa otypowane jako ResourceSchemaKey<R, z.ZodString | z.ZodNumber>
213 się tyczy kalendarza który jeszcze nie jest zmergowany, więc twoje błędy mogą co najwyżej być podobne a zarazem naprawialne |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
f0f114b to
30753c2
Compare
Resolves #197