From 4dcb965b8764612a3f89038768af4d6483ab3cae Mon Sep 17 00:00:00 2001 From: Donkie Date: Mon, 18 Dec 2023 21:52:22 +0100 Subject: [PATCH] Translated help page --- client/public/locales/en/common.json | 21 ++++++- client/src/pages/help/index.tsx | 90 +++++++++++++--------------- 2 files changed, 62 insertions(+), 49 deletions(-) diff --git a/client/public/locales/en/common.json b/client/public/locales/en/common.json index d5ba7ad..b69f3be 100644 --- a/client/public/locales/en/common.json +++ b/client/public/locales/en/common.json @@ -239,7 +239,26 @@ "home": "Home" }, "help": { - "help": "Help" + "help": "Help", + "resources": { + "filament": "Brands of filament. They have properties such as name, material, color, diameter, and more.", + "spool": "Individual physical spools of a specific filament.", + "vendor": "The companies that make the filament." + }, + "description": [ + "Help", + "

Here are some tips to get you started.

", + "

Spoolman holds 3 different types of data:

", + "

To enter a new spool into the database, you first need to create a Filament", + "object for it. Once that is done, you can then create a Spool object for that", + "individual spool. If you then purchase additional spools of the same filament, you can just create additional", + "Spool objects, and re-use the same Filament object.

", + "

You can optionally also create a Vendor object for the company that makes the", + "filament, if you want to track that information.

", + "

You can connect other 3D printer services to Spoolman, such as Moonraker, which can then automatically track", + "filament usage and update the Spool objects for you. See the Spoolman README", + "for how to do that.

" + ] }, "table": { "actions": "Actions" diff --git a/client/src/pages/help/index.tsx b/client/src/pages/help/index.tsx index 7394435..625be25 100644 --- a/client/src/pages/help/index.tsx +++ b/client/src/pages/help/index.tsx @@ -1,5 +1,5 @@ import React from "react"; -import { IResourceComponentsProps } from "@refinedev/core"; +import { IResourceComponentsProps, useTranslate } from "@refinedev/core"; import dayjs from "dayjs"; import utc from "dayjs/plugin/utc"; import { Content } from "antd/es/layout/layout"; @@ -7,6 +7,7 @@ import { List, theme } from "antd"; import Title from "antd/es/typography/Title"; import { FileOutlined, HighlightOutlined, UserOutlined } from "@ant-design/icons"; import { Link } from "react-router-dom"; +import { Trans } from "react-i18next"; dayjs.extend(utc); @@ -14,7 +15,7 @@ const { useToken } = theme; export const Help: React.FC = () => { const { token } = useToken(); - // const t = useTranslate(); + const t = useTranslate(); return ( = () => { lineHeight: 1.5, }} > - Help -

Here are some tips to get you started.

-

Spoolman holds 3 different types of data:

- , - }, - { - title: "Spools", - description: "Individual physical spools of a specific filament.", - icon: , - }, - { - title: "Vendors", - description: "The companies that make the filament.", - icon: , - }, - ]} - renderItem={(item) => ( - - - - )} + , + title: , + filamentCreateLink: <Link to="/filament/create" />, + spoolCreateLink: <Link to="/spool/create" />, + vendorCreateLink: <Link to="/vendor/create" />, + readmeLink: <Link to="https://github.com/Donkie/Spoolman#integration-status" target="_blank" />, + itemsHelp: ( + <List + itemLayout="horizontal" + size="large" + dataSource={[ + { + title: t("filament.filament"), + description: t("help.resources.filament"), + icon: <HighlightOutlined />, + }, + { + title: t("spool.spool"), + description: t("help.resources.spool"), + icon: <FileOutlined />, + }, + { + title: t("vendor.vendor"), + description: t("help.resources.vendor"), + icon: <UserOutlined />, + }, + ]} + renderItem={(item) => ( + <List.Item> + <List.Item.Meta avatar={item.icon} title={item.title} description={item.description} /> + </List.Item> + )} + /> + ), + }} /> - <p> - To enter a new spool into the database, you first need to create a <Link to="/filament/create">Filament</Link>{" "} - object for it. Once that is done, you can then create a <Link to="/spool/create">Spool</Link> object for that - individual spool. If you then purchase additional spools of the same filament, you can just create additional - Spool objects, and re-use the same Filament object. - </p> - <p> - You can optionally also create a <Link to="/vendor/create">Vendor</Link> object for the company that makes the - filament, if you want to track that information. - </p> - <p> - You can connect other 3D printer services to Spoolman, such as Moonraker, which can then automatically track - filament usage and update the Spool objects for you. See the{" "} - <a href="https://github.com/Donkie/Spoolman#integration-status" target="_blank"> - Spoolman README - </a>{" "} - for how to do that. - </p> </Content> ); };