File tree Expand file tree Collapse file tree 5 files changed +48
-0
lines changed
pages/dashboard/templates/ui/components
widgets/dashboard/templates Expand file tree Collapse file tree 5 files changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import {
2323 useCreateSubscriptionTemplate ,
2424 useGetSubscriptionTemplates
2525} from '@shared/api/hooks'
26+ import { UniversalSpotlightActionIconShared } from '@shared/ui/universal-spotlight'
2627import { ROUTES } from '@shared/constants'
2728import { queryClient } from '@shared/api'
2829
@@ -73,6 +74,8 @@ export const TemplatesHeaderActionButtonsFeature = (props: IProps) => {
7374
7475 return (
7576 < Group grow preventGrowOverflow = { false } wrap = "wrap" >
77+ < UniversalSpotlightActionIconShared />
78+
7679 < ActionIconGroup >
7780 < Tooltip label = { t ( 'header-action-buttons.feature.update-templates' ) } withArrow >
7881 < ActionIcon
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { motion } from 'motion/react'
66
77import { TemplatesHeaderActionButtonsFeature } from '@features/ui/dashboard/templates/header-action-buttons'
88import { TemplatesGridWidget } from '@widgets/dashboard/templates/templates-grid/templates-grid.widget'
9+ import { TemplatesSpotlightWidget } from '@widgets/dashboard/templates/templates-spotlight'
910import { RenameModalShared } from '@shared/ui/modals/rename-modal.shared'
1011import { getCoreLogoFromType } from '@shared/ui/get-core-logo-from-type'
1112import { Page , PageHeaderShared } from '@shared/ui'
@@ -35,6 +36,8 @@ export const TemplateBasePageComponent = (props: Props) => {
3536 < TemplatesGridWidget templates = { templates } templateTitle = { title } type = { type } />
3637 </ motion . div >
3738
39+ < TemplatesSpotlightWidget templates = { templates } />
40+
3841 < RenameModalShared key = "rename-template-modal" renameFrom = "template" />
3942 </ Page >
4043 )
Original file line number Diff line number Diff line change @@ -96,6 +96,7 @@ export function TemplatesGridWidget(props: IProps) {
9696 columnCount = { columnCount }
9797 enableDnd = { true }
9898 items = { templates }
99+ key = { `templates-grid-widget-${ type } ` }
99100 onReorder = { handleReorder }
100101 renderDragOverlay = { ( template ) => (
101102 < TemplatesCardWidget
Original file line number Diff line number Diff line change 1+ export * from './templates-spotlight'
Original file line number Diff line number Diff line change 1+ import {
2+ GetSubscriptionTemplatesCommand ,
3+ TSubscriptionTemplateType
4+ } from '@remnawave/backend-contract'
5+ import { generatePath , useNavigate } from 'react-router-dom'
6+
7+ import { UniversalSpotlightContentShared } from '@shared/ui/universal-spotlight'
8+ import { getCoreLogoFromType } from '@shared/ui'
9+ import { ROUTES } from '@shared/constants'
10+
11+ interface IProps {
12+ templates : GetSubscriptionTemplatesCommand . Response [ 'response' ] [ 'templates' ]
13+ }
14+
15+ export const TemplatesSpotlightWidget = ( props : IProps ) => {
16+ const { templates } = props
17+
18+ const navigate = useNavigate ( )
19+
20+ const handleViewTemplate = ( templateUuid : string , templateType : TSubscriptionTemplateType ) => {
21+ navigate (
22+ generatePath ( ROUTES . DASHBOARD . TEMPLATES . TEMPLATE_EDITOR , {
23+ type : templateType ,
24+ uuid : templateUuid
25+ } )
26+ )
27+ }
28+
29+ return (
30+ < UniversalSpotlightContentShared
31+ actions = { templates . map ( ( template ) => ( {
32+ label : template . name ,
33+ id : template . uuid ,
34+ leftSection : getCoreLogoFromType ( { type : template . templateType } ) ,
35+
36+ onClick : ( ) => handleViewTemplate ( template . uuid , template . templateType )
37+ } ) ) }
38+ />
39+ )
40+ }
You can’t perform that action at this time.
0 commit comments