-
-
Notifications
You must be signed in to change notification settings - Fork 328
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: space card sorting is affected by pin * feat: pin empty text
- Loading branch information
Showing
10 changed files
with
84 additions
and
39 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
12 changes: 12 additions & 0 deletions
12
apps/nextjs-app/src/features/app/blocks/space/useBaseList.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,12 @@ | ||
import { useQuery } from '@tanstack/react-query'; | ||
import { getBaseAll } from '@teable/openapi'; | ||
import { ReactQueryKeys } from '@teable/sdk/config'; | ||
|
||
export const useBaseList = () => { | ||
const { data: baseList } = useQuery({ | ||
queryKey: ReactQueryKeys.baseAll(), | ||
queryFn: () => getBaseAll().then((res) => res.data), | ||
}); | ||
|
||
return baseList; | ||
}; |
31 changes: 31 additions & 0 deletions
31
apps/nextjs-app/src/features/app/blocks/space/useSpaceListOrdered.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,31 @@ | ||
import { useQuery } from '@tanstack/react-query'; | ||
import { getSpaceList } from '@teable/openapi'; | ||
import { ReactQueryKeys } from '@teable/sdk/config'; | ||
import { useMemo } from 'react'; | ||
import { usePinMap } from './usePinMap'; | ||
|
||
export const useSpaceListOrdered = () => { | ||
const { data: spaceList } = useQuery({ | ||
queryKey: ReactQueryKeys.spaceList(), | ||
queryFn: getSpaceList, | ||
}); | ||
|
||
const pinMap = usePinMap(); | ||
|
||
return useMemo(() => { | ||
if (!spaceList?.data || !pinMap) { | ||
return []; | ||
} | ||
return [...spaceList.data].sort((a, b) => { | ||
const aPin = pinMap[a.id]; | ||
const bPin = pinMap[b.id]; | ||
if (!bPin) { | ||
return -1; | ||
} | ||
if (!aPin && bPin) { | ||
return 1; | ||
} | ||
return aPin.order - bPin.order; | ||
}); | ||
}, [pinMap, spaceList?.data]); | ||
}; |
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 |
---|---|---|
|
@@ -28,6 +28,7 @@ | |
"pin": { | ||
"add": "添加到收藏", | ||
"remove": "从收藏中移除", | ||
"pin": "收藏" | ||
"pin": "收藏", | ||
"empty": "您收藏的数据库和空间将显示在这里" | ||
} | ||
} |
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