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) => { const categoryClicked = (e: React.MouseEvent, id: string) => {
if (e.detail === 2) { if (e.detail === 2) {
if (id === Constants.categoryIds.all) return
dispatch(redirectToCategoryDetails(id)) dispatch(redirectToCategoryDetails(id))
} else { } else {
dispatch(redirectToCategory(id)) dispatch(redirectToCategory(id))

View File

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

View File

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