Skip to content

Commit

Permalink
Merge branch 'locationspage' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Donkie committed Nov 24, 2024
2 parents bb0b00b + 46a9097 commit c571412
Show file tree
Hide file tree
Showing 22 changed files with 2,424 additions and 876 deletions.
2,207 changes: 1,396 additions & 811 deletions client/package-lock.json

Large diffs are not rendered by default.

50 changes: 27 additions & 23 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,49 +7,53 @@
"private": true,
"type": "module",
"dependencies": {
"@ant-design/icons": "^5.4.0",
"@ant-design/icons": "^5.5.1",
"@loadable/component": "^5.16.4",
"@refinedev/antd": "^5.42.0",
"@refinedev/core": "^4.53.0",
"@refinedev/antd": "^5.44.0",
"@refinedev/core": "^4.56.0",
"@refinedev/kbar": "^1.3.12",
"@refinedev/react-router-v6": "^4.5.11",
"@refinedev/react-router-v6": "^4.6.0",
"@refinedev/simple-rest": "^5.0.8",
"@tanstack/react-query": "^4.36.1",
"@tanstack/react-query-devtools": "^4.36.1",
"@types/loadable__component": "^5.13.9",
"@types/lodash": "^4.17.7",
"@types/lodash": "^4.17.13",
"@types/uuid": "^10.0.0",
"@yudiel/react-qr-scanner": "^1.2.10",
"antd": "^5.20.0",
"antd": "^5.22.1",
"axios": "^1.7.7",
"flag-icons": "^7.2.3",
"html-to-image": "^1.11.11",
"i18next": "^23.12.2",
"i18next": "^23.16.6",
"i18next-browser-languagedetector": "^8.0.0",
"i18next-http-backend": "^2.5.2",
"i18next-http-backend": "^2.6.2",
"lodash": "^4.17.21",
"react": "^18.3.1",
"react-dnd": "^16.0.1",
"react-dnd-html5-backend": "^16.0.1",
"react-dom": "^18.3.1",
"react-i18next": "^15.0.0",
"react-router-dom": "^6.26.0",
"react-i18next": "^15.1.1",
"react-router-dom": "^6.28.0",
"react-to-print": "^2.15.1",
"uuid": "^10.0.0",
"vite-plugin-svgr": "^4.2.0"
"uuid": "^11.0.3",
"vite-plugin-svgr": "^4.3.0",
"zustand": "^5.0.1"
},
"devDependencies": {
"@refinedev/cli": "^2.16.36",
"@types/node": "^20.14.6",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/parser": "^8.0.0",
"@vitejs/plugin-react": "^4.3.1",
"@refinedev/cli": "^2.16.39",
"@simbathesailor/use-what-changed": "^2.0.0",
"@types/node": "^22.9.1",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@typescript-eslint/eslint-plugin": "^8.15.0",
"@typescript-eslint/parser": "^8.15.0",
"@vitejs/plugin-react": "^4.3.3",
"eslint": "^9.8.0",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-refresh": "^0.4.9",
"typescript": "^5.5.4",
"vite": "^5.4.6",
"vite-plugin-mkcert": "^1.17.5"
"typescript": "^5.6.3",
"vite": "^5.4.11",
"vite-plugin-mkcert": "^1.17.6"
},
"scripts": {
"dev": "refine dev",
Expand All @@ -70,4 +74,4 @@
"last 1 safari version"
]
}
}
}
12 changes: 12 additions & 0 deletions client/public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@
},
"messages": {
"archive": "Are you sure you want to archive this spool?"
},
"formats": {
"last_used": "Last used {{date}}"
}
},
"filament": {
Expand Down Expand Up @@ -356,6 +359,9 @@
"help": {
"list": "Help | Spoolman"
},
"locations": {
"list": "Locations | Spoolman"
},
"filament": {
"list": "Filaments | Spoolman",
"show": "#{{id}} Show Filament | Spoolman",
Expand All @@ -377,5 +383,11 @@
"create": "Create Manufacturer | Spoolman",
"clone": "#{{id}} Clone Manufacturer | Spoolman"
}
},
"locations": {
"locations": "Locations",
"new_location": "New Location",
"no_location": "No Location",
"no_locations_help": "This page lets you organize your spools in locations, add some spools to get started!"
}
}
9 changes: 8 additions & 1 deletion client/public/locales/sv/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@
"measurement_type_label": "Mättyp",
"adjust_filament_value": "Mängd att konsumera",
"adjust_filament_help": "Här kan du direkt lägga till eller subtrahera filament från spolen. Ett positivt värde kommer att konsumera filament, ett negativt värde kommer att lägga till det."
},
"formats": {
"last_used": "Senast använd {{date}}"
}
},
"filament": {
Expand Down Expand Up @@ -376,5 +379,9 @@
"description": "<title>Hjälp</title><p>Här är några tips för att komma igång.</p><p>Spoolman innehåller 3 olika typer av data:</p><itemsHelp/><p>För att lägga till en ny spole i databasen måste du först skapa ett <filamentCreateLink>Filament</filamentCreateLink>-objekt för den. När det är klart kan du sedan skapa ett <spoolCreateLink>Spol</spoolCreateLink>-objekt för den individuella spolen. Om du sedan köper ytterligare spolar av samma filament kan du bara skapa ytterligare Spol-objekt och återanvända samma Filament-objekt.</p><p>Du kan valfritt också skapa ett <vendorCreateLink>Tillverkar</vendorCreateLink>-objekt för företaget som tillverkar filamentet om du vill spåra den informationen.</p><p>Du kan koppla andra 3D-skrivartjänster till Spoolman, som Moonraker, som sedan automatiskt kan spåra filamentanvändning och uppdatera Spol-objekten åt dig. Se <readmeLink>Spoolman README</readmeLink> för hur du gör det.</p>",
"help": "Hjälp"
},
"kofi": "Dricksa mig på Ko-fi"
"kofi": "Dricksa mig på Ko-fi",
"locations": {
"new_location": "Ny plats",
"no_location": "Ingen plats"
}
}
10 changes: 10 additions & 0 deletions client/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
HighlightOutlined,
HomeOutlined,
QuestionOutlined,
TableOutlined,
ToolOutlined,
UserOutlined,
} from "@ant-design/icons";
Expand Down Expand Up @@ -148,6 +149,14 @@ function App() {
icon: <UserOutlined />,
},
},
{
name: "locations",
list: "/locations",
meta: {
canDelete: false,
icon: <TableOutlined />,
},
},
{
name: "settings",
list: "/settings",
Expand Down Expand Up @@ -222,6 +231,7 @@ function App() {
</Route>
<Route path="/settings/*" element={<LoadablePage name="settings" />} />
<Route path="/help" element={<LoadablePage name="help" />} />
<Route path="/locations" element={<LoadablePage name="locations" />} />
<Route path="*" element={<ErrorComponent />} />
</Route>
</Routes>
Expand Down
2 changes: 0 additions & 2 deletions client/src/components/dataProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ const dataProvider = (
params: queryParams,
});

// console.log(url, requestMethod, queryParams, data, headers)

return {
data,
total: parseInt(headers["x-total-count"]) ?? 100,
Expand Down
27 changes: 27 additions & 0 deletions client/src/i18n.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import dayjs from "dayjs";
import i18n from "i18next";
import detector from "i18next-browser-languagedetector";
import Backend from "i18next-http-backend";
Expand All @@ -8,6 +9,7 @@ interface Language {
name: string;
countryCode: string;
fullCode: string;
djs: () => Promise<ILocale>;
}

/**
Expand All @@ -16,107 +18,128 @@ interface Language {
* name: Name of the language in the list
* countryCode: Country code of the country's flag to display for this language
* fullCode: Full language code, used for Ant Design's locale
* djs: Function to load the dayjs locale, see https://github.com/iamkun/dayjs/tree/dev/src/locale for list of locales
*/
export const languages: { [key: string]: Language } = {
["en"]: {
name: "English",
countryCode: "gb",
fullCode: "en-GB",
djs: () => import("dayjs/locale/en"),
},
["sv"]: {
name: "Svenska",
countryCode: "se",
fullCode: "sv-SE",
djs: () => import("dayjs/locale/sv"),
},
["de"]: {
name: "Deutsch",
countryCode: "de",
fullCode: "de-DE",
djs: () => import("dayjs/locale/de"),
},
["es"]: {
name: "Español",
countryCode: "es",
fullCode: "es-ES",
djs: () => import("dayjs/locale/es"),
},
["zh"]: {
name: "简体中文",
countryCode: "cn",
fullCode: "zh-CN",
djs: () => import("dayjs/locale/zh-cn"),
},
["zh-Hant"]: {
name: "繁體中文",
countryCode: "cn",
fullCode: "zh-TW",
djs: () => import("dayjs/locale/zh-hk"),
},
["pl"]: {
name: "Polski",
countryCode: "pl",
fullCode: "pl-PL",
djs: () => import("dayjs/locale/pl"),
},
["ru"]: {
name: "Русский",
countryCode: "ru",
fullCode: "ru-RU",
djs: () => import("dayjs/locale/ru"),
},
["cs"]: {
name: "Česky",
countryCode: "cz",
fullCode: "cs-CZ",
djs: () => import("dayjs/locale/cs"),
},
["nb-NO"]: {
name: "Norsk bokmål",
countryCode: "no",
fullCode: "nb-NO",
djs: () => import("dayjs/locale/nb"),
},
["nl"]: {
name: "Nederlands",
countryCode: "nl",
fullCode: "nl-NL",
djs: () => import("dayjs/locale/nl"),
},
["fr"]: {
name: "Français",
countryCode: "fr",
fullCode: "fr-FR",
djs: () => import("dayjs/locale/fr"),
},
["hu"]: {
name: "Magyar",
countryCode: "hu",
fullCode: "hu-HU",
djs: () => import("dayjs/locale/hu"),
},
["it"]: {
name: "Italiano",
countryCode: "it",
fullCode: "it-IT",
djs: () => import("dayjs/locale/it"),
},
["uk"]: {
name: "Українська",
countryCode: "ua",
fullCode: "uk-UA",
djs: () => import("dayjs/locale/uk"),
},
["el"]: {
name: "Ελληνικά",
countryCode: "gr",
fullCode: "el-GR",
djs: () => import("dayjs/locale/el"),
},
["da"]: {
name: "Dansk",
countryCode: "dk",
fullCode: "da-DK",
djs: () => import("dayjs/locale/da"),
},
["pt"]: {
name: "Português",
countryCode: "pt",
fullCode: "pt-PT",
djs: () => import("dayjs/locale/pt"),
},
["fa"]: {
name: "فارسی",
countryCode: "ir",
fullCode: "fa-IR",
djs: () => import("dayjs/locale/fa"),
},
["ro"]: {
name: "Român",
countryCode: "ro",
fullCode: "ro-RO",
djs: () => import("dayjs/locale/ro"),
},
};

Expand All @@ -134,4 +157,8 @@ i18n
fallbackLng: "en",
});

i18n.on("languageChanged", function (lng) {
languages[lng].djs().then((djs) => dayjs.locale(djs.name));
});

export default i18n;
15 changes: 7 additions & 8 deletions client/src/pages/filaments/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ export const FilamentEdit: React.FC<IResourceComponentsProps> = () => {

// Update colorType state
useEffect(() => {
console.log(formProps.initialValues?.multi_color_hexes);
if (formProps.initialValues?.multi_color_hexes) {
setColorType("multi");
} else {
Expand Down Expand Up @@ -325,13 +324,13 @@ export const FilamentEdit: React.FC<IResourceComponentsProps> = () => {
<Input maxLength={64} />
</Form.Item>
<Form.Item
label={t("filament.fields.external_id")}
name={["external_id"]}
rules={[
{
required: false,
},
]}
label={t("filament.fields.external_id")}
name={["external_id"]}
rules={[
{
required: false,
},
]}
>
<Input maxLength={64} />
</Form.Item>
Expand Down
Loading

0 comments on commit c571412

Please sign in to comment.