-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update org tabs * Update drawer & UI components * Add no data viewer * Update links block * Update edit links drawer * Add draggable context * Update link forms * Update form * Update org links * Add org owner restriction to edit links * Fix review issues * Update no data icon
- Loading branch information
Showing
25 changed files
with
758 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { Stack, StackProps, Typography, useTheme } from '@mui/material' | ||
import { ReactNode } from 'react' | ||
|
||
import { UiIcon } from '@/ui' | ||
|
||
interface Props extends StackProps { | ||
icon?: ReactNode | ||
title?: string | ||
description?: string | ||
action?: ReactNode | ||
} | ||
|
||
export default function NoDataViewer({ | ||
icon = <UiIcon componentName='folderOff' />, | ||
title = 'No data', | ||
description, | ||
action, | ||
...rest | ||
}: Props) { | ||
const { palette, spacing } = useTheme() | ||
|
||
return ( | ||
<Stack | ||
spacing={4} | ||
alignItems={'center'} | ||
width={'100%'} | ||
justifyContent={'center'} | ||
p={8} | ||
border={1} | ||
borderColor={palette.action.hover} | ||
borderRadius={2} | ||
sx={{ borderStyle: 'dashed', ...rest.sx }} | ||
{...rest} | ||
> | ||
<Stack | ||
alignItems={'center'} | ||
justifyContent={'center'} | ||
bgcolor={palette.action.active} | ||
color={palette.text.secondary} | ||
borderRadius={250} | ||
width={spacing(12)} | ||
height={spacing(12)} | ||
> | ||
{icon} | ||
</Stack> | ||
<Stack spacing={1} textAlign={'center'}> | ||
<Typography variant='body3'>{title}</Typography> | ||
{description && ( | ||
<Typography variant='body3' color={palette.text.secondary}> | ||
{description} | ||
</Typography> | ||
)} | ||
</Stack> | ||
{action} | ||
</Stack> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { | ||
closestCenter, | ||
DndContext, | ||
PointerSensor, | ||
TouchSensor, | ||
UniqueIdentifier, | ||
useSensor, | ||
useSensors, | ||
} from '@dnd-kit/core' | ||
import { restrictToParentElement, restrictToVerticalAxis } from '@dnd-kit/modifiers' | ||
import { arrayMove, SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable' | ||
import { PropsWithChildren } from 'react' | ||
|
||
type SortableId = UniqueIdentifier | { id: UniqueIdentifier } | ||
|
||
interface Props<T extends SortableId> extends PropsWithChildren { | ||
items: T[] | ||
onItemsChange?: (items: T[]) => void | ||
onItemsMove?: (oldIndex: number, newIndex: number) => void | ||
} | ||
|
||
export default function VerticalDraggableContext<T extends SortableId>({ | ||
items, | ||
onItemsMove, | ||
onItemsChange, | ||
children, | ||
}: Props<T>) { | ||
const sensors = useSensors(useSensor(PointerSensor), useSensor(TouchSensor)) | ||
|
||
return ( | ||
<DndContext | ||
sensors={sensors} | ||
collisionDetection={closestCenter} | ||
modifiers={[restrictToParentElement, restrictToVerticalAxis]} | ||
onDragEnd={({ active, over }) => { | ||
if (!over?.id) return | ||
|
||
if (active.id !== over.id) { | ||
const itemIds = items.map(item => (typeof item === 'object' ? item.id : item)) | ||
const oldIndex = itemIds.indexOf(active.id) | ||
const newIndex = itemIds.indexOf(over.id) | ||
|
||
onItemsMove?.(oldIndex, newIndex) | ||
onItemsChange?.(arrayMove(items, oldIndex, newIndex)) | ||
} | ||
}} | ||
> | ||
<SortableContext items={items} strategy={verticalListSortingStrategy}> | ||
{children} | ||
</SortableContext> | ||
</DndContext> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.