* feat: begin switching sonner, currently this breaks all alerts * feat: switch to using new sonner and fix class names * feat: add Shortcut component for improved keyboard shortcuts display in default layout * feat: rewrite quick menu modal in shadcn * feat: update QuickMenu modal placeholders and localize no results message in default layout * feat: begin switching modals in layout to use shadcn dialog, needs bug fixing * feat: implement DialogProvider for consistent dialog management across components * fix: types * feat: begin adding shadcn label selector (wip) * feat: shadcnify textarea * feat: begin adding location selector * feat: add hotkey support for opening create modals in dialog provider components * fix: update click event on NuxtLink and reorder sidebar menu item IDs for consistency * feat: unify shortcut text across create modals and sort issue with text centring * feat: prevent dialog from opening when a dialog alert is open * fix: prevent potential out of bounds error * feat: enhance button group UI in create modals for better layout and introduce new item photo label in the form * fix: search on label selector * chore: lint * fix: oops * feat: make selector usable * feat: add actual data to label selector * feat: label selector kinda works * fix: add legacy selector for edit page * fix: enable camera capture in image upload for CreateModal component * fix: z levels for sidebar mobile * fix: gap between inputs * feat: update radix-vue, custom search function for location selector * feat: add fuzzysort (can always remove it and go to lunr if we want to) * feat: limit label name to 50 characters in create modal and selector, helps with issues with ui not working with larger labels, as it is only enforced on the frontend could be easily bypassed but thats a them problem * feat: add colours to toast * chore: lint * feat: abstract the dialog for creation modals * feat: add drawer component and responsive dialog for create modals * feat: enhance photo preview in CreateModal * fix: remember state of sidebar * feat: add ui functionality for changing primary image * feat: use button for file upload * style: lint * fix: dont clone asset id * fix: using create and add label breaks selector * chore: oops remove logging * chore: lint * fix: cut length of label dramatically to ensure maximal compatibility, not sure if too much * fix: more limiting of label length * feat: update reka-ui (prev radix-vue) * chore: cleanup dialog provider and siebar provider a bit * fix: improve accessibility * fix: docs for shadcn error * fix: hack to prevent issues with lots of toasts in quick succession * feat: cleanup toast file and lint * feat: improvements to dialog scroll and disable the ability to set default photo for now * feat: add tooltips for photo buttons * chore: substring to length check Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2.1 KiB
Shadcn-Vue
Shadcn-Vue is a collection of Vue components based on shadcn/ui. We are currently in the process of migrating from DaisyUI to Shadcn-Vue for our component system.
What is shadcn-vue?
To quote shadcn-vue:
This is NOT a component library. It's a collection of re-usable components that you can copy and paste or use the CLI to add to your apps. What do you mean not a component library? It means you do not install it as a dependency. It is not available or distributed via npm, with no plans to publish it. Pick the components you need. Use the CLI to automatically add the components, or copy and paste the code into your project and customize to your needs. The code is yours.
The key advantage of this approach is that we have full control over the components and can modify them to suit our specific needs without being constrained by a third-party dependency.
Adding Components
-
Add components using the CLI:
pnpx shadcn-vue@latest add [component-name]For example:
pnpx shadcn-vue@latest add button -
The components will be added to the route in the
components/uiit then needs to be moved tofrontend/components/uifor use.
Usage
-
Import components from the components directory:
import { Button } from '@/components/ui/button' -
Components can be used with their respective props and slots as documented in the shadcn-vue documentation.
Modifying Components
When modifying components, follow these best practices:
-
If you need to modify a component for a specific use case:
- Copy the component and give it a name that reflects its purpose
- Keep the original shadcn component intact for other uses
-
When making global changes:
- Modify the component in the
components/uidirectory - Document any significant changes in comments
- Modify the component in the
Testing without DaisyUI
During the migration process, you can test without DaisyUI using these commands:
export DISABLE_DAISYUI=true; task ui:dev
or
export DISABLE_DAISYUI=true; task ui:fix