feat: sortable feed list

Signed-off-by: Innei <i@innei.in>
This commit is contained in:
Innei 2024-08-23 20:39:58 +08:00
parent b9fecc46bf
commit fdd2623554
No known key found for this signature in database
GPG Key ID: 0F62D33977F021F7
7 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none"><path fill="#fff" fill-opacity=".01" d="M24 0v24H0V0z"/><path stroke="#10161F" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5.714 9h4.572M5 11a35.518 35.518 0 0 1 2.365-6.715.496.496 0 0 1 .45-.285h.37c.192 0 .368.11.45.285A35.52 35.52 0 0 1 11 11m-6 3h5.5a.5.5 0 0 1 .3.9l-5.6 4.2a.5.5 0 0 0 .3.9H11m6-15v14m2.828-2c-.691 1.251-1.577 2.137-2.828 2.828-1.251-.691-2.137-1.577-2.828-2.828"/></svg>

After

Width:  |  Height:  |  Size: 494 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none"><path fill="#fff" fill-opacity=".01" d="M24 0v24H0V0z"/><path stroke="#10161F" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5.714 9h4.572M5 11a35.518 35.518 0 0 1 2.365-6.715.496.496 0 0 1 .45-.285h.37c.192 0 .368.11.45.285A35.52 35.52 0 0 1 11 11m-6 3h5.5a.5.5 0 0 1 .3.9l-5.6 4.2a.5.5 0 0 0 .3.9H11m6 0V6m2.828 2C19.138 6.75 18.252 5.863 17 5.172 15.75 5.863 14.863 6.749 14.172 8"/></svg>

After

Width:  |  Height:  |  Size: 489 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none"><path fill="#fff" fill-opacity=".01" d="M24 0v24H0V0z"/><path fill="#10161F" fill-rule="evenodd" d="M18.87 15.272c-.239-.283-.506-.473-.866-.473s-.626.19-.865.473c-.228.271-.464.669-.756 1.162-.072.121-.142.244-.212.367-.28.5-.507.903-.628 1.236-.126.348-.157.674.023.986.18.312.478.448.842.512.35.062.811.068 1.384.074.142.002.283.002.425 0 .572-.006 1.035-.012 1.384-.074.364-.064.662-.2.842-.512.18-.312.15-.638.023-.986-.121-.334-.348-.736-.628-1.236-.07-.123-.14-.245-.213-.367-.291-.493-.527-.89-.755-1.162M18.87 5.272c-.239-.284-.506-.474-.866-.474s-.626.19-.865.474c-.228.271-.464.669-.756 1.161-.072.122-.142.245-.212.368-.28.5-.507.902-.628 1.235-.126.349-.157.675.023.987.18.311.478.447.842.512.35.062.811.067 1.384.074h.425c.572-.007 1.035-.012 1.384-.074.364-.065.662-.2.842-.512.18-.312.15-.638.023-.987-.121-.333-.348-.736-.628-1.235-.07-.123-.14-.246-.213-.368-.291-.492-.527-.89-.755-1.161" clip-rule="evenodd"/><path stroke="#10161F" stroke-linecap="round" stroke-width="2" d="M4 5h8m-8 7h8m-8 7h8"/></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none"><path fill="#fff" fill-opacity=".01" d="M24 0v24H0V0z"/><path stroke="#10161F" stroke-linecap="round" stroke-width="2" d="M4 5h8m-8 7h8m-8 7h8"/><path fill="#10161F" fill-rule="evenodd" d="M18.87 9.137c-.239.283-.506.473-.866.473s-.626-.19-.865-.473c-.228-.272-.464-.67-.756-1.162a19.097 19.097 0 0 1-.212-.368c-.28-.499-.507-.902-.628-1.235-.126-.348-.157-.674.023-.986.18-.312.478-.448.842-.513.35-.062.811-.067 1.384-.073.142-.002.283-.002.425 0 .572.006 1.035.011 1.384.073.364.065.662.201.842.513.18.312.15.638.023.986-.121.333-.348.736-.628 1.235-.07.124-.14.246-.213.368-.291.493-.527.89-.755 1.162M18.87 19.137c-.239.283-.506.473-.866.473s-.626-.19-.865-.473c-.228-.271-.464-.669-.756-1.162a19.156 19.156 0 0 1-.212-.367c-.28-.5-.507-.902-.628-1.236-.126-.348-.157-.674.023-.986.18-.312.478-.448.842-.512.35-.062.811-.068 1.384-.074.142-.002.283-.002.425 0 .572.006 1.035.012 1.384.074.364.064.662.2.842.512.18.312.15.638.023.986-.121.334-.348.736-.628 1.236-.07.123-.14.246-.213.367-.291.493-.527.89-.755 1.162" clip-rule="evenodd"/></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none"><path fill="#fff" fill-opacity=".01" d="M24 0v24H0V0z"/><path stroke="#10161F" stroke-linecap="round" stroke-width="2" d="M4 12h9m-9 7h9M4 5h7m7 14V5m2.828 2c-.646-1.17-1.462-2.02-2.588-2.69a.468.468 0 0 0-.48 0c-1.126.67-1.942 1.52-2.588 2.69"/></svg>

After

Width:  |  Height:  |  Size: 327 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none"><path fill="#fff" fill-opacity=".01" d="M24 0v24H0V0z"/><path stroke="#10161F" stroke-linecap="round" stroke-width="2" d="M18 5v14m-2.828-2c.646 1.17 1.462 2.02 2.588 2.69a.468.468 0 0 0 .48 0c1.126-.67 1.942-1.52 2.588-2.69M4 12h9M4 5h9M4 19h7"/></svg>

After

Width:  |  Height:  |  Size: 328 B

View File

@ -0,0 +1,41 @@
import { createAtomHooks } from "@renderer/lib/jotai"
import { getStorageNS } from "@renderer/lib/ns"
import { atomWithStorage } from "jotai/utils"
export type FeedListSortBy = "count" | "alphabetical"
export type FeedListSortOrder = "asc" | "desc"
const [
,
,
useFeedListSort,
,
getFeedListSort,
setFeedListSort,
useFeedListSortSelector,
] = createAtomHooks(
atomWithStorage(
getStorageNS("feedListSort"),
{
by: "count" as FeedListSortBy,
order: "desc" as FeedListSortOrder,
},
undefined,
{ getOnInit: true },
),
)
export { getFeedListSort, useFeedListSort, useFeedListSortSelector }
export const setFeedListSortBy = (by: FeedListSortBy) => {
setFeedListSort({
...getFeedListSort(),
by,
})
}
export const setFeedListSortOrder = (order: FeedListSortOrder) => {
setFeedListSort({
...getFeedListSort(),
order,
})
}