From 720f6de6fdd06cd23aa5ca2072f9cd353808f0bf Mon Sep 17 00:00:00 2001 From: NlightN22 Date: Sat, 30 Nov 2024 15:14:28 +0700 Subject: [PATCH] add placeholders to text editors FrigateHostsPage.tsx --- src/locales/en.ts | 14 ++++++---- src/locales/ru.ts | 6 +++- src/widgets/SelectedHostList.tsx | 2 +- src/widgets/hosts.table/FrigateHostsTable.tsx | 28 ++++++++++++++----- src/widgets/hosts.table/TextInputCell.tsx | 10 +++++-- 5 files changed, 44 insertions(+), 16 deletions(-) diff --git a/src/locales/en.ts b/src/locales/en.ts index 859338e..ea124ca 100644 --- a/src/locales/en.ts +++ b/src/locales/en.ts @@ -83,11 +83,15 @@ const en = { hostsConfig: 'Frigate servers', acessSettings: 'Access settings', }, - hostArr: { - host: 'Host', - name: 'Host name', - url: 'Address', - enabled: 'Enabled', + frigateHostTableTitles: { + host: 'Хост', + name: 'Имя хоста', + url: 'Адрес', + enabled: 'Включен', + }, + frigateHostTablePlaceholders: { + host: 'http://host.docker.internal:5000 or http://192.168.1.1:5000', + name: 'YourFrigateHostName', }, player: { startVideo: 'Enable Video', diff --git a/src/locales/ru.ts b/src/locales/ru.ts index 5850ad3..5470ee5 100644 --- a/src/locales/ru.ts +++ b/src/locales/ru.ts @@ -81,12 +81,16 @@ const ru = { hostsConfig: 'Серверы Frigate', acessSettings: 'Настройка доступа', }, - hostArr: { + frigateHostTableTitles: { host: 'Хост', name: 'Имя хоста', url: 'Адрес', enabled: 'Включен', }, + frigateHostTablePlaceholders: { + host: 'http://host.docker.internal:5000 or http://192.168.1.1:5000', + name: 'YourFrigateHostName', + }, player: { startVideo: 'Вкл. Видео', stopVideo: 'Выкл. Видео', diff --git a/src/widgets/SelectedHostList.tsx b/src/widgets/SelectedHostList.tsx index 425eb18..d39fed0 100644 --- a/src/widgets/SelectedHostList.tsx +++ b/src/widgets/SelectedHostList.tsx @@ -60,7 +60,7 @@ const SelectedHostList = ({ return ( - {t('hostArr.host')}: {camerasQuery[0].frigateHost?.name} + {t('frigateHostTableTitles.host')}: {camerasQuery[0].frigateHost?.name} { setTableData(data); - }, [data]); + }, [data]); useEffect(() => { if (!isProduction) console.log('TableData', tableData) - if (changedCallback) + if (changedCallback) changedCallback(tableData) }, [tableData]) @@ -48,9 +48,9 @@ const FrigateHostsTable = ({ data, showAddButton = false, saveCallback, changedC } const headTitle = [ - { propertyName: 'name', title: t('hostArr.host') }, - { propertyName: 'host', title: t('hostArr.url') }, - { propertyName: 'enabled', title: t('hostArr.enabled') }, + { propertyName: 'name', title: t('frigateHostTableTitles.host') }, + { propertyName: 'host', title: t('frigateHostTableTitles.url') }, + { propertyName: 'enabled', title: t('frigateHostTableTitles.enabled') }, { title: '', sorting: false }, ] @@ -108,8 +108,22 @@ const FrigateHostsTable = ({ data, showAddButton = false, saveCallback, changedC const rows = tableData.map(item => { return ( - - + + diff --git a/src/widgets/hosts.table/TextInputCell.tsx b/src/widgets/hosts.table/TextInputCell.tsx index 9358e72..4abb998 100644 --- a/src/widgets/hosts.table/TextInputCell.tsx +++ b/src/widgets/hosts.table/TextInputCell.tsx @@ -12,9 +12,10 @@ interface TextImputCellProps { propertyName: string, value?: string | number | boolean, ) => void, + placeholder?: string | undefined } -const TextInputCell = ({ text, width, id, propertyName, onChange }: TextImputCellProps) => { +const TextInputCell = ({ text, width, id, propertyName, onChange, placeholder }: TextImputCellProps) => { const [value, setValue] = useState(text); const [debouncedValue] = useDebouncedValue(value, 300) useEffect(() => { @@ -28,7 +29,12 @@ const TextInputCell = ({ text, width, id, propertyName, onChange }: TextImputCel } return ( - + ) }