-
-
Notifications
You must be signed in to change notification settings - Fork 568
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: gallery view * fix: lint type * chore: update i18n * fix: presort interaction * fix: the rendering for group by date field validation * fix: display tooltip when text ellipsis is activated * fix: rendering of card title
- Loading branch information
Showing
72 changed files
with
1,169 additions
and
78 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
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
8 changes: 8 additions & 0 deletions
8
apps/nestjs-backend/src/features/view/model/gallery-view.dto.ts
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,8 @@ | ||
import type { IShareViewMeta } from '@teable/core'; | ||
import { GalleryViewCore } from '@teable/core'; | ||
|
||
export class GalleryViewDto extends GalleryViewCore { | ||
defaultShareMeta: IShareViewMeta = { | ||
includeRecords: true, | ||
}; | ||
} |
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
47 changes: 47 additions & 0 deletions
47
apps/nextjs-app/src/features/app/blocks/share/view/component/gallery/GalleryView.tsx
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,47 @@ | ||
/* eslint-disable @next/next/no-html-link-for-pages */ | ||
import { TeableNew } from '@teable/icons'; | ||
import { RecordProvider, RowCountProvider, ShareViewContext } from '@teable/sdk/context'; | ||
import { SearchProvider } from '@teable/sdk/context/query'; | ||
import { useIsHydrated } from '@teable/sdk/hooks'; | ||
import { cn } from '@teable/ui-lib/shadcn'; | ||
import { useRouter } from 'next/router'; | ||
import { useContext } from 'react'; | ||
import { GalleryProvider } from '@/features/app/blocks/view/gallery/context'; | ||
import { GalleryViewBase } from '@/features/app/blocks/view/gallery/GalleryViewBase'; | ||
import { GalleryToolbar } from './toolbar'; | ||
|
||
export const GalleryView = () => { | ||
const { view } = useContext(ShareViewContext); | ||
const isHydrated = useIsHydrated(); | ||
const { | ||
query: { hideToolBar, embed }, | ||
} = useRouter(); | ||
|
||
return ( | ||
<div className={cn('flex size-full flex-col', embed ? '' : 'md:px-3 md:pb-3')}> | ||
{!embed && ( | ||
<div className="flex w-full justify-between px-1 py-2 md:px-0 md:py-3"> | ||
<h1 className="font-semibold md:text-lg">{view?.name}</h1> | ||
<a href="/" className="flex items-center"> | ||
<TeableNew className="text-black md:text-2xl" /> | ||
<p className="ml-1 font-semibold">Teable</p> | ||
</a> | ||
</div> | ||
)} | ||
<div className="flex w-full grow flex-col overflow-hidden border md:rounded md:shadow-md"> | ||
<SearchProvider> | ||
<RecordProvider> | ||
<RowCountProvider> | ||
{!hideToolBar && <GalleryToolbar />} | ||
<GalleryProvider> | ||
<div className="w-full grow overflow-hidden"> | ||
{isHydrated && <GalleryViewBase />} | ||
</div> | ||
</GalleryProvider> | ||
</RowCountProvider> | ||
</RecordProvider> | ||
</SearchProvider> | ||
</div> | ||
</div> | ||
); | ||
}; |
58 changes: 58 additions & 0 deletions
58
apps/nextjs-app/src/features/app/blocks/share/view/component/gallery/toolbar/Toolbar.tsx
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,58 @@ | ||
import { ArrowUpDown, Filter as FilterIcon } from '@teable/icons'; | ||
import type { GalleryView } from '@teable/sdk'; | ||
import { useView } from '@teable/sdk/hooks/use-view'; | ||
import { cn } from '@teable/ui-lib/shadcn'; | ||
import { useToolbarChange } from '@/features/app/blocks/view/hooks/useToolbarChange'; | ||
import { SearchButton } from '@/features/app/blocks/view/search/SearchButton'; | ||
import { ToolBarButton } from '@/features/app/blocks/view/tool-bar/ToolBarButton'; | ||
import { Sort } from '../../grid/toolbar/Sort'; | ||
import { ShareViewFilter } from '../../share-view-filter'; | ||
|
||
export const GalleryToolbar: React.FC<{ disabled?: boolean }> = (props) => { | ||
const { disabled } = props; | ||
const view = useView() as GalleryView | undefined; | ||
const { onFilterChange, onSortChange } = useToolbarChange(); | ||
|
||
if (!view) return null; | ||
|
||
return ( | ||
<div className="flex w-full items-center justify-between gap-2 border-b px-4 py-2 @container/toolbar"> | ||
<ShareViewFilter filters={view?.filter || null} onChange={onFilterChange}> | ||
{(text, isActive) => ( | ||
<ToolBarButton | ||
disabled={disabled} | ||
isActive={isActive} | ||
text={text} | ||
className={cn( | ||
'max-w-xs', | ||
isActive && | ||
'bg-violet-100 dark:bg-violet-600/30 hover:bg-violet-200 dark:hover:bg-violet-500/30' | ||
)} | ||
textClassName="@2xl/toolbar:inline" | ||
> | ||
<FilterIcon className="size-4 text-sm" /> | ||
</ToolBarButton> | ||
)} | ||
</ShareViewFilter> | ||
<Sort sorts={view?.sort || null} onChange={onSortChange}> | ||
{(text: string, isActive) => ( | ||
<ToolBarButton | ||
isActive={isActive} | ||
text={text} | ||
className={cn( | ||
'max-w-xs', | ||
isActive && | ||
'bg-orange-100 dark:bg-orange-600/30 hover:bg-orange-200 dark:hover:bg-orange-500/30' | ||
)} | ||
textClassName="@2xl/toolbar:inline" | ||
> | ||
<ArrowUpDown className="size-4 text-sm" /> | ||
</ToolBarButton> | ||
)} | ||
</Sort> | ||
<div className="flex w-10 flex-1 justify-end"> | ||
<SearchButton /> | ||
</div> | ||
</div> | ||
); | ||
}; |
1 change: 1 addition & 0 deletions
1
apps/nextjs-app/src/features/app/blocks/share/view/component/gallery/toolbar/index.ts
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 @@ | ||
export * from './Toolbar'; |
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
23 changes: 23 additions & 0 deletions
23
apps/nextjs-app/src/features/app/blocks/view/gallery/GalleryView.tsx
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,23 @@ | ||
import { RecordProvider, RowCountProvider } from '@teable/sdk/context'; | ||
import { SearchProvider } from '@teable/sdk/context/query'; | ||
import { useIsHydrated } from '@teable/sdk/hooks'; | ||
import { GalleryToolBar } from '../tool-bar/GalleryToolBar'; | ||
import { GalleryProvider } from './context'; | ||
import { GalleryViewBase } from './GalleryViewBase'; | ||
|
||
export const GalleryView = () => { | ||
const isHydrated = useIsHydrated(); | ||
|
||
return ( | ||
<SearchProvider> | ||
<RecordProvider> | ||
<RowCountProvider> | ||
<GalleryToolBar /> | ||
<GalleryProvider> | ||
<div className="w-full grow overflow-hidden">{isHydrated && <GalleryViewBase />}</div> | ||
</GalleryProvider> | ||
</RowCountProvider> | ||
</RecordProvider> | ||
</SearchProvider> | ||
); | ||
}; |
Oops, something went wrong.