Skip to content

Conversation

@diffiii
Copy link
Member

@diffiii diffiii commented Dec 1, 2025

Resolves #197

Copilot AI review requested due to automatic review settings December 1, 2025 23:52
Copy link

Copilot AI left a 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 ToggleButton component with flexible state management
  • Configured toggle functionality for NotificationTopics and StudentOrganizations resources
  • Deprecated the old ToggleOrganizationStatusButton component 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.

@diffiii diffiii requested a review from kguzek December 2, 2025 00:05
@diffiii diffiii self-assigned this Dec 2, 2025
@diffiii diffiii force-pushed the feat/abstract-toggle-status-button branch from 9afb24e to e3d79c7 Compare December 3, 2025 23:59
@diffiii diffiii requested a review from kguzek December 4, 2025 00:01
@diffiii diffiii force-pushed the feat/abstract-toggle-status-button branch 4 times, most recently from 09bfd8c to f0f114b Compare December 9, 2025 23:30
@diffiii
Copy link
Member Author

diffiii commented Dec 9, 2025

Z tego co zauważyłem testy nie przechodzą przez #213

Comment on lines 54 to 60
const fieldValue = getFieldValue(
body,
config.field as unknown as ResourceSchemaKey<
T,
z.ZodString | z.ZodNumber
>,
) as unknown;
Copy link
Member Author

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

Copy link
Member

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>

@diffiii diffiii requested a review from kguzek December 9, 2025 23:33
@kguzek
Copy link
Member

kguzek commented Dec 10, 2025

Z tego co zauważyłem testy nie przechodzą przez #213

213 się tyczy kalendarza który jeszcze nie jest zmergowany, więc twoje błędy mogą co najwyżej być podobne a zarazem naprawialne

@kguzek kguzek force-pushed the feat/abstract-toggle-status-button branch from f0f114b to 30753c2 Compare December 28, 2025 01:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dodać możliwośc deaktywacji kategorii powiadomienia

3 participants