mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-07-06 09:51:29 +02:00
Final localization keys and values
This commit is contained in:
@@ -9,17 +9,17 @@ import { LocalizationKey } from '../../../localization';
|
||||
|
||||
export interface IGroupingProps { }
|
||||
|
||||
export const GROUP_OPTIONS = [
|
||||
{ name: l10n.t(LocalizationKey.dashboardHeaderGroupingOptionNone), id: GroupOption.none },
|
||||
{ name: l10n.t(LocalizationKey.dashboardHeaderGroupingOptionYear), id: GroupOption.Year },
|
||||
{ name: l10n.t(LocalizationKey.dashboardHeaderGroupingOptionDraft), id: GroupOption.Draft }
|
||||
];
|
||||
|
||||
export const Grouping: React.FunctionComponent<
|
||||
IGroupingProps
|
||||
> = ({ }: React.PropsWithChildren<IGroupingProps>) => {
|
||||
const [group, setGroup] = useRecoilState(GroupingAtom);
|
||||
|
||||
const GROUP_OPTIONS = [
|
||||
{ name: l10n.t(LocalizationKey.dashboardHeaderGroupingOptionNone), id: GroupOption.none },
|
||||
{ name: l10n.t(LocalizationKey.dashboardHeaderGroupingOptionYear), id: GroupOption.Year },
|
||||
{ name: l10n.t(LocalizationKey.dashboardHeaderGroupingOptionDraft), id: GroupOption.Draft }
|
||||
];
|
||||
|
||||
const crntGroup = GROUP_OPTIONS.find((x) => x.id === group);
|
||||
|
||||
return (
|
||||
|
||||
@@ -16,12 +16,6 @@ export interface INavigationItemProps {
|
||||
onClick: () => void;
|
||||
}
|
||||
|
||||
export const tabs = [
|
||||
{ name: l10n.t(LocalizationKey.dashboardHeaderNavigationAllArticles), id: Tab.All },
|
||||
{ name: l10n.t(LocalizationKey.dashboardHeaderNavigationPublished), id: Tab.Published },
|
||||
{ name: l10n.t(LocalizationKey.dashboardHeaderNavigationDraft), id: Tab.Draft }
|
||||
];
|
||||
|
||||
const NavigationItem: React.FunctionComponent<INavigationItemProps> = ({
|
||||
tabId,
|
||||
isCrntTab,
|
||||
@@ -58,6 +52,12 @@ export const Navigation: React.FunctionComponent<INavigationProps> = ({
|
||||
const tabInfo = useRecoilValue(TabInfoAtom);
|
||||
const settings = useRecoilValue(SettingsAtom);
|
||||
|
||||
const tabs = [
|
||||
{ name: l10n.t(LocalizationKey.dashboardHeaderNavigationAllArticles), id: Tab.All },
|
||||
{ name: l10n.t(LocalizationKey.dashboardHeaderNavigationPublished), id: Tab.Published },
|
||||
{ name: l10n.t(LocalizationKey.dashboardHeaderNavigationDraft), id: Tab.Draft }
|
||||
];
|
||||
|
||||
return (
|
||||
<nav className="flex-1 -mb-px flex space-x-6 xl:space-x-8" aria-label="Tabs">
|
||||
{settings?.draftField?.type === 'boolean' ? (
|
||||
|
||||
@@ -19,87 +19,6 @@ export interface ISortingProps {
|
||||
view: NavigationType;
|
||||
}
|
||||
|
||||
export const sortOptions: SortingOption[] = [
|
||||
{
|
||||
name: l10n.t(LocalizationKey.dashboardHeaderSortingLastModifiedAsc),
|
||||
id: SortOption.LastModifiedAsc,
|
||||
order: SortOrder.asc,
|
||||
type: SortType.date
|
||||
},
|
||||
{
|
||||
name: l10n.t(LocalizationKey.dashboardHeaderSortingLastModifiedDesc),
|
||||
id: SortOption.LastModifiedDesc,
|
||||
order: SortOrder.desc,
|
||||
type: SortType.date
|
||||
},
|
||||
{
|
||||
name: l10n.t(LocalizationKey.dashboardHeaderSortingFilenameAsc),
|
||||
id: SortOption.FileNameAsc,
|
||||
order: SortOrder.asc,
|
||||
type: SortType.string
|
||||
},
|
||||
{
|
||||
name: l10n.t(LocalizationKey.dashboardHeaderSortingFilenameDesc),
|
||||
id: SortOption.FileNameDesc,
|
||||
order: SortOrder.desc,
|
||||
type: SortType.string
|
||||
}
|
||||
];
|
||||
|
||||
const contentSortOptions: SortingOption[] = [
|
||||
{
|
||||
name: l10n.t(LocalizationKey.dashboardHeaderSortingPublishedAsc),
|
||||
id: SortOption.PublishedAsc,
|
||||
order: SortOrder.asc,
|
||||
type: SortType.date
|
||||
},
|
||||
{
|
||||
name: l10n.t(LocalizationKey.dashboardHeaderSortingPublishedDesc),
|
||||
id: SortOption.PublishedDesc,
|
||||
order: SortOrder.desc,
|
||||
type: SortType.date
|
||||
}
|
||||
];
|
||||
|
||||
const mediaSortOptions: SortingOption[] = [
|
||||
{
|
||||
name: l10n.t(LocalizationKey.dashboardHeaderSortingSizeAsc),
|
||||
id: SortOption.SizeAsc,
|
||||
order: SortOrder.asc,
|
||||
type: SortType.number
|
||||
},
|
||||
{
|
||||
name: l10n.t(LocalizationKey.dashboardHeaderSortingSizeDesc),
|
||||
id: SortOption.SizeDesc,
|
||||
order: SortOrder.desc,
|
||||
type: SortType.number
|
||||
},
|
||||
{
|
||||
name: l10n.t(LocalizationKey.dashboardHeaderSortingCaptionAsc),
|
||||
id: SortOption.CaptionAsc,
|
||||
order: SortOrder.asc,
|
||||
type: SortType.string
|
||||
},
|
||||
{
|
||||
name: l10n.t(LocalizationKey.dashboardHeaderSortingCaptionDesc),
|
||||
id: SortOption.CaptionDesc,
|
||||
order: SortOrder.desc,
|
||||
type: SortType.string
|
||||
},
|
||||
{
|
||||
name: l10n.t(LocalizationKey.dashboardHeaderSortingAltAsc),
|
||||
id: SortOption.AltAsc,
|
||||
order: SortOrder.asc,
|
||||
type: SortType.string
|
||||
},
|
||||
{
|
||||
name: l10n.t(LocalizationKey.dashboardHeaderSortingAltDesc),
|
||||
id: SortOption.AltDesc,
|
||||
order: SortOrder.desc,
|
||||
type: SortType.string
|
||||
}
|
||||
];
|
||||
|
||||
export const Sorting: React.FunctionComponent<ISortingProps> = ({
|
||||
disableCustomSorting,
|
||||
view
|
||||
@@ -108,6 +27,87 @@ export const Sorting: React.FunctionComponent<ISortingProps> = ({
|
||||
const searchValue = useRecoilValue(SearchSelector);
|
||||
const settings = useRecoilValue(SettingsSelector);
|
||||
|
||||
const sortOptions: SortingOption[] = [
|
||||
{
|
||||
name: l10n.t(LocalizationKey.dashboardHeaderSortingLastModifiedAsc),
|
||||
id: SortOption.LastModifiedAsc,
|
||||
order: SortOrder.asc,
|
||||
type: SortType.date
|
||||
},
|
||||
{
|
||||
name: l10n.t(LocalizationKey.dashboardHeaderSortingLastModifiedDesc),
|
||||
id: SortOption.LastModifiedDesc,
|
||||
order: SortOrder.desc,
|
||||
type: SortType.date
|
||||
},
|
||||
{
|
||||
name: l10n.t(LocalizationKey.dashboardHeaderSortingFilenameAsc),
|
||||
id: SortOption.FileNameAsc,
|
||||
order: SortOrder.asc,
|
||||
type: SortType.string
|
||||
},
|
||||
{
|
||||
name: l10n.t(LocalizationKey.dashboardHeaderSortingFilenameDesc),
|
||||
id: SortOption.FileNameDesc,
|
||||
order: SortOrder.desc,
|
||||
type: SortType.string
|
||||
}
|
||||
];
|
||||
|
||||
const contentSortOptions: SortingOption[] = [
|
||||
{
|
||||
name: l10n.t(LocalizationKey.dashboardHeaderSortingPublishedAsc),
|
||||
id: SortOption.PublishedAsc,
|
||||
order: SortOrder.asc,
|
||||
type: SortType.date
|
||||
},
|
||||
{
|
||||
name: l10n.t(LocalizationKey.dashboardHeaderSortingPublishedDesc),
|
||||
id: SortOption.PublishedDesc,
|
||||
order: SortOrder.desc,
|
||||
type: SortType.date
|
||||
}
|
||||
];
|
||||
|
||||
const mediaSortOptions: SortingOption[] = [
|
||||
{
|
||||
name: l10n.t(LocalizationKey.dashboardHeaderSortingSizeAsc),
|
||||
id: SortOption.SizeAsc,
|
||||
order: SortOrder.asc,
|
||||
type: SortType.number
|
||||
},
|
||||
{
|
||||
name: l10n.t(LocalizationKey.dashboardHeaderSortingSizeDesc),
|
||||
id: SortOption.SizeDesc,
|
||||
order: SortOrder.desc,
|
||||
type: SortType.number
|
||||
},
|
||||
{
|
||||
name: l10n.t(LocalizationKey.dashboardHeaderSortingCaptionAsc),
|
||||
id: SortOption.CaptionAsc,
|
||||
order: SortOrder.asc,
|
||||
type: SortType.string
|
||||
},
|
||||
{
|
||||
name: l10n.t(LocalizationKey.dashboardHeaderSortingCaptionDesc),
|
||||
id: SortOption.CaptionDesc,
|
||||
order: SortOrder.desc,
|
||||
type: SortType.string
|
||||
},
|
||||
{
|
||||
name: l10n.t(LocalizationKey.dashboardHeaderSortingAltAsc),
|
||||
id: SortOption.AltAsc,
|
||||
order: SortOrder.asc,
|
||||
type: SortType.string
|
||||
},
|
||||
{
|
||||
name: l10n.t(LocalizationKey.dashboardHeaderSortingAltDesc),
|
||||
id: SortOption.AltDesc,
|
||||
order: SortOrder.desc,
|
||||
type: SortType.string
|
||||
}
|
||||
];
|
||||
|
||||
const updateSorting = (value: SortingOption) => {
|
||||
Messenger.send(DashboardMessage.setState, {
|
||||
key: `${view === NavigationType.Contents
|
||||
|
||||
@@ -6,6 +6,8 @@ import { Messenger } from '@estruyf/vscode/dist/client';
|
||||
import { DashboardMessage } from '../../DashboardMessage';
|
||||
import { DashboardViewType } from '../../models';
|
||||
import useThemeColors from '../../hooks/useThemeColors';
|
||||
import * as l10n from '@vscode/l10n';
|
||||
import { LocalizationKey } from '../../../localization';
|
||||
|
||||
export interface IViewSwitchProps { }
|
||||
|
||||
@@ -34,18 +36,26 @@ export const ViewSwitch: React.FunctionComponent<IViewSwitchProps> = (
|
||||
<button
|
||||
className={`flex items-center px-2 py-1 rounded-l-sm ${view === DashboardViewType.Grid ? getColors('bg-teal-500 text-vulcan-500', 'bg-[var(--frontmatter-button-background)] text-[var(--vscode-button-foreground)]') : 'text-[var(--vscode-button-secondaryForeground)] hover:bg-[var(--vscode-button-secondaryHoverBackground)]'
|
||||
}`}
|
||||
title={l10n.t(LocalizationKey.dashboardHeaderViewSwitchToGrid)}
|
||||
type={`button`}
|
||||
onClick={toggleView}
|
||||
>
|
||||
<ViewGridIcon className={`w-4 h-4`} />
|
||||
<span className={`sr-only`}>Change to grid</span>
|
||||
<span className={`sr-only`}>
|
||||
{l10n.t(LocalizationKey.dashboardHeaderViewSwitchToGrid)}
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
className={`flex items-center px-2 py-1 rounded-r-sm ${view === DashboardViewType.List ? getColors('bg-teal-500 text-vulcan-500', 'bg-[var(--frontmatter-button-background)] text-[var(--vscode-button-foreground)]') : 'text-[var(--vscode-button-secondaryForeground)] hover:bg-[var(--vscode-button-secondaryHoverBackground)]'
|
||||
}`}
|
||||
title={l10n.t(LocalizationKey.dashboardHeaderViewSwitchToList)}
|
||||
type={`button`}
|
||||
onClick={toggleView}
|
||||
>
|
||||
<ViewListIcon className={`w-4 h-4`} />
|
||||
<span className={`sr-only`}>Change to list</span>
|
||||
<span className={`sr-only`}>
|
||||
{l10n.t(LocalizationKey.dashboardHeaderViewSwitchToList)}
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user