add details page for "All" to be be able to get the generated feed url

This commit is contained in:
Athou
2022-08-15 09:28:03 +02:00
parent 448feedace
commit 6f26c54b62
3 changed files with 25 additions and 19 deletions

View File

@@ -29,7 +29,6 @@ export function Tree() {
}
const categoryClicked = (e: React.MouseEvent, id: string) => {
if (e.detail === 2) {
if (id === Constants.categoryIds.all) return
dispatch(redirectToCategoryDetails(id))
} else {
dispatch(redirectToCategory(id))

View File

@@ -69,6 +69,7 @@ export function CategoryDetailsPage() {
})
}, [setValues, category])
const editable = id !== Constants.categoryIds.all
if (!category) return <Loader />
return (
<Container>
@@ -102,26 +103,34 @@ export function CategoryDetailsPage() {
</Box>
</Input.Wrapper>
<TextInput label={t`Name`} {...form.getInputProps("name")} required />
<CategorySelect label={t`Parent Category`} {...form.getInputProps("parentId")} clearable />
<NumberInput label={t`Position`} {...form.getInputProps("position")} required min={0} />
{editable && (
<>
<TextInput label={t`Name`} {...form.getInputProps("name")} required />
<CategorySelect label={t`Parent Category`} {...form.getInputProps("parentId")} clearable />
<NumberInput label={t`Position`} {...form.getInputProps("position")} required min={0} />
</>
)}
<Group>
<Button variant="default" onClick={() => dispatch(redirectToSelectedSource())}>
<Trans>Cancel</Trans>
</Button>
<Button type="submit" leftIcon={<TbDeviceFloppy size={16} />} loading={modifyCategory.loading}>
<Trans>Save</Trans>
</Button>
<Divider orientation="vertical" />
<Button
color="red"
leftIcon={<TbTrash size={16} />}
onClick={() => openDeleteCategoryModal()}
loading={deleteCategory.loading}
>
<Trans>Delete</Trans>
</Button>
{editable && (
<>
<Button type="submit" leftIcon={<TbDeviceFloppy size={16} />} loading={modifyCategory.loading}>
<Trans>Save</Trans>
</Button>
<Divider orientation="vertical" />
<Button
color="red"
leftIcon={<TbTrash size={16} />}
onClick={() => openDeleteCategoryModal()}
loading={deleteCategory.loading}
>
<Trans>Delete</Trans>
</Button>
</>
)}
</Group>
</Stack>
</form>

View File

@@ -47,8 +47,6 @@ export function FeedEntriesPage(props: FeedEntriesPageProps) {
dispatch(loadEntries({ type: props.sourceType, id }))
}, [dispatch, props.sourceType, id, location.state])
const hideEditButton = props.sourceType === "category" && id === Constants.categoryIds.all
const noSubscriptions = rootCategory && flattenCategoryTree(rootCategory).every(c => c.feeds.length === 0)
if (noSubscriptions) return <NoSubscriptionHelp />
return (
@@ -61,7 +59,7 @@ export function FeedEntriesPage(props: FeedEntriesPageProps) {
</Anchor>
)}
{!sourceWebsiteUrl && <Title order={3}>{sourceLabel}</Title>}
{sourceLabel && !hideEditButton && (
{sourceLabel && (
<ActionIcon onClick={titleClicked} variant="subtle" color={theme.primaryColor}>
<TbEdit size={18} />
</ActionIcon>