mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
'All' and 'Starred' labels are now translatable (#1765)
This commit is contained in:
@@ -9,7 +9,7 @@ import { Constants } from "app/constants"
|
|||||||
import { redirectToRootCategory, redirectToSelectedSource } from "app/redirect/thunks"
|
import { redirectToRootCategory, redirectToSelectedSource } from "app/redirect/thunks"
|
||||||
import { useAppDispatch, useAppSelector } from "app/store"
|
import { useAppDispatch, useAppSelector } from "app/store"
|
||||||
import { reloadTree } from "app/tree/thunks"
|
import { reloadTree } from "app/tree/thunks"
|
||||||
import type { CategoryModificationRequest } from "app/types"
|
import type { Category, CategoryModificationRequest } from "app/types"
|
||||||
import { flattenCategoryTree } from "app/utils"
|
import { flattenCategoryTree } from "app/utils"
|
||||||
import { Alert } from "components/Alert"
|
import { Alert } from "components/Alert"
|
||||||
import { Loader } from "components/Loader"
|
import { Loader } from "components/Loader"
|
||||||
@@ -27,10 +27,15 @@ export function CategoryDetailsPage() {
|
|||||||
const dispatch = useAppDispatch()
|
const dispatch = useAppDispatch()
|
||||||
|
|
||||||
const query = useAsync(async () => await client.category.getRoot(), [])
|
const query = useAsync(async () => await client.category.getRoot(), [])
|
||||||
const category =
|
|
||||||
id === Constants.categories.starred.id
|
let category: Category | undefined
|
||||||
? { ...Constants.categories.starred, name: _(msg`Starred`) }
|
if (id === Constants.categories.all.id) {
|
||||||
: query.result && flattenCategoryTree(query.result.data).find(c => c.id === id)
|
category = { ...Constants.categories.starred, name: _(msg`All`) }
|
||||||
|
} else if (id === Constants.categories.starred.id) {
|
||||||
|
category = { ...Constants.categories.all, name: _(msg`Starred`) }
|
||||||
|
} else {
|
||||||
|
category = query.result && flattenCategoryTree(query.result.data).find(c => c.id === id)
|
||||||
|
}
|
||||||
|
|
||||||
const form = useForm<CategoryModificationRequest>()
|
const form = useForm<CategoryModificationRequest>()
|
||||||
const { setValues } = form
|
const { setValues } = form
|
||||||
|
|||||||
@@ -48,6 +48,13 @@ export function FeedEntriesPage(props: FeedEntriesPageProps) {
|
|||||||
const hasMore = useAppSelector(state => state.entries.hasMore)
|
const hasMore = useAppSelector(state => state.entries.hasMore)
|
||||||
const dispatch = useAppDispatch()
|
const dispatch = useAppDispatch()
|
||||||
|
|
||||||
|
let title: React.ReactNode = sourceLabel
|
||||||
|
if (id === Constants.categories.all.id) {
|
||||||
|
title = <Trans>All</Trans>
|
||||||
|
} else if (id === Constants.categories.starred.id) {
|
||||||
|
title = <Trans>Starred</Trans>
|
||||||
|
}
|
||||||
|
|
||||||
const titleClicked = () => {
|
const titleClicked = () => {
|
||||||
switch (props.sourceType) {
|
switch (props.sourceType) {
|
||||||
case "category":
|
case "category":
|
||||||
@@ -84,15 +91,13 @@ export function FeedEntriesPage(props: FeedEntriesPageProps) {
|
|||||||
<Group gap="xl">
|
<Group gap="xl">
|
||||||
{sourceWebsiteUrl && (
|
{sourceWebsiteUrl && (
|
||||||
<a href={sourceWebsiteUrl} target="_blank" rel="noreferrer" className={classes.sourceWebsiteLink}>
|
<a href={sourceWebsiteUrl} target="_blank" rel="noreferrer" className={classes.sourceWebsiteLink}>
|
||||||
<Title order={3}>{sourceLabel}</Title>
|
<Title order={3}>{title}</Title>
|
||||||
</a>
|
</a>
|
||||||
)}
|
)}
|
||||||
{!sourceWebsiteUrl && <Title order={3}>{sourceLabel}</Title>}
|
{!sourceWebsiteUrl && <Title order={3}>{title}</Title>}
|
||||||
{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>
|
|
||||||
)}
|
|
||||||
</Group>
|
</Group>
|
||||||
|
|
||||||
<FeedEntries />
|
<FeedEntries />
|
||||||
|
|||||||
Reference in New Issue
Block a user