Skip to content

Commit

Permalink
refactor(playground): shorten imports
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasnobile committed Mar 15, 2024
1 parent a4ff1cb commit 95c7579
Show file tree
Hide file tree
Showing 15 changed files with 31 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import * as React from 'react'
import { ReactElement } from 'react'
import { DeleteEntityTrigger } from '@contember/interface'
import { FeedbackTrigger } from './persist'
import { dict } from '../../../lib/dict'
import { dict } from '../../dict'

export const DeleteEntityDialog = ({ trigger }: { trigger: ReactElement }) => {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { IdentityState } from '@contember/react-identity'
import { Loader } from '../ui/loader'
import { dict } from '../../../lib/dict'
import { dict } from '../../dict'

export const IdentityLoader = ({ children }: {
children: React.ReactNode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { cn } from '../../../lib/utils/cn'
import { cn } from '../../utils/cn'
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '../ui/dropdown'
import { Button } from '../ui/button'
import { ReactNode } from 'react'
import { ArrowDownAZIcon, ArrowUpDownIcon, ArrowUpZaIcon, EyeOffIcon } from 'lucide-react'
import { DataViewSelectionTrigger, DataViewSortingSwitch, DataViewSortingTrigger } from '@contember/react-dataview'
import { dict } from '../../../lib/dict'
import { dict } from '../../dict'


export function DataViewColumnHeader<TData, TValue>({ sortingField, hidingName, children }: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react'
import { dict } from '../../../lib/dict'
import { dict } from '../../dict'

export const DataViewNoResults = () => (
<div className={'p-4 text-lg rounded-md border'}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { DataViewBooleanFilterTrigger, DataViewNullFilterTrigger } from '@contem
import { Popover, PopoverContent, PopoverTrigger } from '../../ui/popover'
import { DataViewActiveFilterUI, DataViewFilterSelectTriggerUI, DataViewSingleFilterUI } from '../ui'
import { DataViewNullFilter } from './common'
import { formatBoolean } from '../../../../lib/utils/formatting'
import { formatBoolean } from '../../../utils/formatting'
import { Button } from '../../ui/button'
import { dict } from '../../../../lib/dict'
import { dict } from '../../../dict'


export const DataViewBooleanFilterList = ({ name }: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react'
import { ReactEventHandler, useCallback } from 'react'
import { useDataViewNullFilter } from '@contember/react-dataview'
import { DataViewFilterSelectItemUI } from '../ui'
import { dict } from '../../../../lib/dict'
import { dict } from '../../../dict'

export const DataViewNullFilter = ({ name }: {
name: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { Popover, PopoverContent, PopoverTrigger } from '../../ui/popover'
import { DataViewActiveFilterUI, DataViewFilterSelectTriggerUI, DataViewSingleFilterUI } from '../ui'
import { DataViewNullFilter } from './common'
import { Input } from '../../ui/input'
import { formatDate } from '../../../../lib/utils/formatting'
import { dict } from '../../../../lib/dict'
import { formatDate } from '../../../utils/formatting'
import { dict } from '../../../dict'

const DataViewDateFilterRange = ({ name }: { name: string }) => {
const [artifact] = useDataViewFilter<DateRangeFilterArtifacts>(name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
DataViewSingleFilterUI,
} from '../ui'
import { DataViewNullFilter } from './common'
import { dict } from '../../../../lib/dict'
import { dict } from '../../../dict'

export const DataViewEnumFieldTooltip = ({ filter, children, actions, value }: { filter: string, children: ReactNode, value: string, actions?: ReactNode }) => (
<TooltipProvider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import { Popover, PopoverContent, PopoverTrigger } from '../../ui/popover'
import { DataViewActiveFilterUI, DataViewFilterSelectTriggerUI, DataViewSingleFilterUI } from '../ui'
import { DataViewNullFilter } from './common'
import { Input } from '../../ui/input'
import { formatNumber } from '../../../../lib/utils/formatting'
import { dict } from '../../../../lib/dict'
import { formatNumber } from '../../../utils/formatting'
import { dict } from '../../../dict'

const DataViewNumberFilterRange = ({ name }: {
name: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Popover, PopoverTrigger } from '../../ui/popover'
import { DataViewActiveFilterUI, DataViewExcludeActionButtonUI, DataViewFilterActionButtonUI, DataViewFilterSelectItemUI, DataViewFilterSelectTriggerUI, DataViewSingleFilterUI } from '../ui'
import { DataViewNullFilter } from './common'
import { createDefaultSelectFilter, SelectListInner, SelectPopoverContent } from '../../select'
import { dict } from '../../../../lib/dict'
import { dict } from '../../../dict'

export const DataViewRelationFieldTooltip = ({ filter, children, actions }: { filter: string, children: ReactNode, actions?: ReactNode }) => (
<TooltipProvider>
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/admin/lib/components/datagrid/grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import { EyeIcon, EyeOffIcon } from 'lucide-react'
import * as React from 'react'
import { Fragment, ReactNode, useMemo } from 'react'
import { dict } from '../../../lib/dict'
import { dict } from '../../dict'
import { Button } from '../ui/button'
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '../ui/dropdown'
import { DataViewNoResults } from './empty'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { DataViewSelectionTrigger } from '@contember/react-dataview'
import { Button } from '../ui/button'
import { LayoutGridIcon, SheetIcon } from 'lucide-react'
import * as React from 'react'
import { dict } from '../../../lib/dict'
import { dict } from '../../dict'

export const DataViewLayoutSwitcher = () => <>
<div className={'space-x-0'}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { Button } from '../ui/button'
import { DataViewChangePageTrigger, DataViewPagingStateView, DataViewSetItemsPerPageTrigger } from '@contember/react-dataview'
import { DropdownMenu } from '@radix-ui/react-dropdown-menu'
import { DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '../ui/dropdown'
import { dictFormat } from '../../../lib/utils/dictFormat'
import { dict } from '../../../lib/dict'
import { dictFormat } from '../../utils/dictFormat'
import { dict } from '../../dict'

export const DataTablePagination = () => (
<div className="flex gap-6 lg:gap-8 justify-between">
Expand Down
4 changes: 2 additions & 2 deletions packages/playground/admin/lib/components/datagrid/ui.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import * as React from 'react'
import { forwardRef, ReactEventHandler, ReactNode, SyntheticEvent, useCallback } from 'react'
import { CheckSquareIcon, FilterIcon, FilterXIcon, PlusIcon, SquareIcon, XIcon } from 'lucide-react'
import { Button } from '../ui/button'
import { cn } from '../../../lib/utils/cn'
import { dict } from '../../../lib/dict'
import { cn } from '../../utils/cn'
import { dict } from '../../dict'

/**
* Button in a tooltip that triggers the filter action
Expand Down
22 changes: 11 additions & 11 deletions packages/playground/admin/lib/components/repeater.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ export const RepeaterDragOverlayUI = uic('div', {
})
export const RepeaterHandleUI = uic('button', {
baseClass: 'absolute top-1/2 -left-6 h-6 w-6 flex justify-end align-center opacity-10 hover:opacity-100 transition-opacity -translate-y-1/2',
beforeChildren: <GripVerticalIcon size={16} />,
beforeChildren: <GripVerticalIcon size={16}/>,
})

export const RepeaterDropIndicator = ({ position }: { position: 'before' | 'after' }) => (
<div className={'relative'}>
<RepeaterSortableDropIndicator position={position}>
<DropIndicator placement={position === 'before' ? 'top' : 'bottom'} />
<DropIndicator placement={position === 'before' ? 'top' : 'bottom'}/>
</RepeaterSortableDropIndicator>
</div>
)
Expand All @@ -49,7 +49,7 @@ export const RepeaterAddItemButton = ({ children }: { children?: React.ReactNode
<div>
<Button variant={'link'} size={'sm'} className={'gap-1 px-0'}>
{children || <>
<PlusCircleIcon size={16} />
<PlusCircleIcon size={16}/>
<span>Add item</span>
</>}
</Button>
Expand All @@ -62,7 +62,7 @@ export const RepeaterRemoveItemButton = ({ children }: { children?: React.ReactN
<div className={'absolute top-1 right-2 flex'}>
<Button variant={'link'} size={'sm'} className={'gap-1 px-0 group'}>
{children || <>
<Trash2Icon className={'group-hover:text-red-600'} size={16} />
<Trash2Icon className={'group-hover:text-red-600'} size={16}/>
</>}
</Button>
</div>
Expand All @@ -84,13 +84,13 @@ export const DefaultRepeater = Component<DefaultRepeaterProps>(({ title, childre
<RepeaterWrapperUI>
<RepeaterEachItem>
<RepeaterItemsWrapperUI>
<RepeaterRemoveItemButton />
<RepeaterRemoveItemButton/>
{children}
</RepeaterItemsWrapperUI>
</RepeaterEachItem>
</RepeaterWrapperUI>

<RepeaterAddItemButton />
<RepeaterAddItemButton/>
</Repeater>
</div>
)
Expand All @@ -103,16 +103,16 @@ export const DefaultRepeater = Component<DefaultRepeaterProps>(({ title, childre
<RepeaterSortable>
<RepeaterSortableEachItem>
<div>
<RepeaterDropIndicator position={'before'} />
<RepeaterDropIndicator position={'before'}/>
<RepeaterSortableItemNode>
<RepeaterItemUI>
<RepeaterSortableItemActivator>
<RepeaterHandleUI />
<RepeaterHandleUI/>
</RepeaterSortableItemActivator>
{children}
</RepeaterItemUI>
</RepeaterSortableItemNode>
<RepeaterDropIndicator position={'after'} />
<RepeaterDropIndicator position={'after'}/>
</div>
</RepeaterSortableEachItem>
<RepeaterSortableDragOverlay>
Expand All @@ -122,11 +122,11 @@ export const DefaultRepeater = Component<DefaultRepeaterProps>(({ title, childre
</RepeaterSortableDragOverlay>
</RepeaterSortable>

<RepeaterAddItemButton />
<RepeaterAddItemButton/>
</RepeaterItemsWrapperUI>
</Repeater>
</div>
)
}, props => {
return <Repeater {...props} />
return <Repeater {...props}/>
})

0 comments on commit 95c7579

Please sign in to comment.