add support for starring entries

This commit is contained in:
Athou
2022-08-19 10:34:04 +02:00
parent 91bc7fa4b0
commit 973fe56cc8
14 changed files with 104 additions and 19 deletions

View File

@@ -31,7 +31,7 @@ function Section(props: { title: string; icon: React.ReactNode; children: React.
}
function NextUnreadBookmarklet() {
const [categoryId, setCategoryId] = useState(Constants.categoryIds.all)
const [categoryId, setCategoryId] = useState(Constants.categories.all.id)
const [order, setOrder] = useState("desc")
const baseUrl = window.location.href.substring(0, window.location.href.lastIndexOf("#"))
const href = `javascript:window.location.href='${baseUrl}next?category=${categoryId}&order=${order}&t='+new Date().getTime();`

View File

@@ -18,13 +18,16 @@ import { TbDeviceFloppy, TbTrash } from "react-icons/tb"
import { useParams } from "react-router-dom"
export function CategoryDetailsPage() {
const { id = Constants.categoryIds.all } = useParams()
const { id = Constants.categories.all.id } = useParams()
const apiKey = useAppSelector(state => state.user.profile?.apiKey)
const dispatch = useAppDispatch()
const query = useAsync(() => client.category.getRoot(), [])
const category = query.result && flattenCategoryTree(query.result.data).find(c => c.id === id)
const category =
id === Constants.categories.starred.id
? Constants.categories.starred
: query.result && flattenCategoryTree(query.result.data).find(c => c.id === id)
const form = useForm<CategoryModificationRequest>()
const { setValues } = form
@@ -69,7 +72,7 @@ export function CategoryDetailsPage() {
})
}, [setValues, category])
const editable = id !== Constants.categoryIds.all
const editable = id !== Constants.categories.all.id && id !== Constants.categories.starred.id
if (!category) return <Loader />
return (
<Container>

View File

@@ -29,7 +29,7 @@ interface FeedEntriesPageProps {
export function FeedEntriesPage(props: FeedEntriesPageProps) {
const location = useLocation()
const { id = Constants.categoryIds.all } = useParams()
const { id = Constants.categories.all.id } = useParams()
const viewport = useViewportSize()
const theme = useMantineTheme()
const rootCategory = useAppSelector(state => state.tree.rootCategory)