mirror of
https://github.com/zadam/trilium.git
synced 2025-12-16 12:24:25 +01:00
refactor(status_bar): solve warnings
This commit is contained in:
parent
6eff62f73f
commit
1b725175c6
@ -6,6 +6,7 @@ import { type ComponentChildren } from "preact";
|
|||||||
import { createPortal } from "preact/compat";
|
import { createPortal } from "preact/compat";
|
||||||
import { useContext, useRef, useState } from "preact/hooks";
|
import { useContext, useRef, useState } from "preact/hooks";
|
||||||
|
|
||||||
|
import { CommandNames } from "../../components/app_context";
|
||||||
import NoteContext from "../../components/note_context";
|
import NoteContext from "../../components/note_context";
|
||||||
import FNote from "../../entities/fnote";
|
import FNote from "../../entities/fnote";
|
||||||
import { t } from "../../services/i18n";
|
import { t } from "../../services/i18n";
|
||||||
@ -15,22 +16,19 @@ import { formatDateTime } from "../../utils/formatters";
|
|||||||
import { BacklinksList, useBacklinkCount } from "../FloatingButtonsDefinitions";
|
import { BacklinksList, useBacklinkCount } from "../FloatingButtonsDefinitions";
|
||||||
import Dropdown, { DropdownProps } from "../react/Dropdown";
|
import Dropdown, { DropdownProps } from "../react/Dropdown";
|
||||||
import { FormDropdownDivider, FormListItem } from "../react/FormList";
|
import { FormDropdownDivider, FormListItem } from "../react/FormList";
|
||||||
import { useActiveNoteContext, useStaticTooltip, useTooltip } from "../react/hooks";
|
import { useActiveNoteContext, useStaticTooltip } from "../react/hooks";
|
||||||
import Icon from "../react/Icon";
|
import Icon from "../react/Icon";
|
||||||
|
import { ParentComponent } from "../react/react_utils";
|
||||||
import { ContentLanguagesModal, useLanguageSwitcher } from "../ribbon/BasicPropertiesTab";
|
import { ContentLanguagesModal, useLanguageSwitcher } from "../ribbon/BasicPropertiesTab";
|
||||||
import { NoteSizeWidget, useNoteMetadata } from "../ribbon/NoteInfoTab";
|
import { NoteSizeWidget, useNoteMetadata } from "../ribbon/NoteInfoTab";
|
||||||
|
import { useAttachments } from "../type_widgets/Attachment";
|
||||||
import { useProcessedLocales } from "../type_widgets/options/components/LocaleSelector";
|
import { useProcessedLocales } from "../type_widgets/options/components/LocaleSelector";
|
||||||
import Breadcrumb from "./Breadcrumb";
|
import Breadcrumb from "./Breadcrumb";
|
||||||
import { useAttachments } from "../type_widgets/Attachment";
|
|
||||||
import ActionButton from "../react/ActionButton";
|
|
||||||
import Button from "../react/Button";
|
|
||||||
import { CommandNames } from "../../components/app_context";
|
|
||||||
import { ParentComponent } from "../react/react_utils";
|
|
||||||
|
|
||||||
interface StatusBarContext {
|
interface StatusBarContext {
|
||||||
note: FNote;
|
note: FNote;
|
||||||
noteContext: NoteContext;
|
noteContext: NoteContext;
|
||||||
viewScope: ViewScope;
|
viewScope?: ViewScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function StatusBar() {
|
export default function StatusBar() {
|
||||||
@ -123,15 +121,16 @@ function LanguageSwitcher({ note }: StatusBarContext) {
|
|||||||
title={t("status_bar.language_title")}
|
title={t("status_bar.language_title")}
|
||||||
text={<span dir={activeLocale?.rtl ? "rtl" : "ltr"}>{getLocaleName(activeLocale)}</span>}
|
text={<span dir={activeLocale?.rtl ? "rtl" : "ltr"}>{getLocaleName(activeLocale)}</span>}
|
||||||
>
|
>
|
||||||
{processedLocales.map(locale => {
|
{processedLocales.map((locale, index) => {
|
||||||
if (typeof locale === "object") {
|
if (typeof locale === "object") {
|
||||||
return <FormListItem
|
return <FormListItem
|
||||||
|
key={locale.id}
|
||||||
rtl={locale.rtl}
|
rtl={locale.rtl}
|
||||||
checked={locale.id === currentNoteLanguage}
|
checked={locale.id === currentNoteLanguage}
|
||||||
onClick={() => setCurrentNoteLanguage(locale.id)}
|
onClick={() => setCurrentNoteLanguage(locale.id)}
|
||||||
>{locale.name}</FormListItem>
|
>{locale.name}</FormListItem>;
|
||||||
} else {
|
} else {
|
||||||
return <FormDropdownDivider />
|
return <FormDropdownDivider key={`divider-${index}`} />;
|
||||||
}
|
}
|
||||||
})}
|
})}
|
||||||
<FormDropdownDivider />
|
<FormDropdownDivider />
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user