Final locations updates
This commit is contained in:
@@ -359,6 +359,9 @@
|
|||||||
"help": {
|
"help": {
|
||||||
"list": "Help | Spoolman"
|
"list": "Help | Spoolman"
|
||||||
},
|
},
|
||||||
|
"locations": {
|
||||||
|
"list": "Locations | Spoolman"
|
||||||
|
},
|
||||||
"filament": {
|
"filament": {
|
||||||
"list": "Filaments | Spoolman",
|
"list": "Filaments | Spoolman",
|
||||||
"show": "#{{id}} Show Filament | Spoolman",
|
"show": "#{{id}} Show Filament | Spoolman",
|
||||||
@@ -382,7 +385,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"locations": {
|
"locations": {
|
||||||
|
"locations": "Locations",
|
||||||
"new_location": "New Location",
|
"new_location": "New Location",
|
||||||
"no_location": "No Location"
|
"no_location": "No Location",
|
||||||
|
"no_locations_help": "This page lets you organize your spools in locations, add some spools to get started!"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Button, Input } from "antd";
|
import { Button, Input, theme } from "antd";
|
||||||
import type { Identifier, XYCoord } from "dnd-core";
|
import type { Identifier, XYCoord } from "dnd-core";
|
||||||
import { useRef, useState } from "react";
|
import { useRef, useState } from "react";
|
||||||
import { useDrag, useDrop } from "react-dnd";
|
import { useDrag, useDrop } from "react-dnd";
|
||||||
@@ -10,6 +10,8 @@ import { DragItem, ItemTypes, SpoolDragItem } from "../dnd";
|
|||||||
import { EMPTYLOC } from "../functions";
|
import { EMPTYLOC } from "../functions";
|
||||||
import { SpoolList } from "./spoolList";
|
import { SpoolList } from "./spoolList";
|
||||||
|
|
||||||
|
const { useToken } = theme;
|
||||||
|
|
||||||
export function Location({
|
export function Location({
|
||||||
index,
|
index,
|
||||||
title,
|
title,
|
||||||
@@ -31,6 +33,7 @@ export function Location({
|
|||||||
locationSpoolOrder: number[];
|
locationSpoolOrder: number[];
|
||||||
setLocationSpoolOrder: (spoolOrder: number[]) => void;
|
setLocationSpoolOrder: (spoolOrder: number[]) => void;
|
||||||
}) {
|
}) {
|
||||||
|
const { token } = useToken();
|
||||||
const t = useTranslate();
|
const t = useTranslate();
|
||||||
const [editTitle, setEditTitle] = useState(false);
|
const [editTitle, setEditTitle] = useState(false);
|
||||||
const [newTitle, setNewTitle] = useState(title);
|
const [newTitle, setNewTitle] = useState(title);
|
||||||
@@ -133,6 +136,10 @@ export function Location({
|
|||||||
|
|
||||||
const canEditTitle = title != EMPTYLOC;
|
const canEditTitle = title != EMPTYLOC;
|
||||||
|
|
||||||
|
const titleStyle = {
|
||||||
|
color: canEditTitle ? undefined : token.colorTextTertiary,
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={"loc-container " + (title != EMPTYLOC ? "grabable" : "")}
|
className={"loc-container " + (title != EMPTYLOC ? "grabable" : "")}
|
||||||
@@ -161,6 +168,7 @@ export function Location({
|
|||||||
setNewTitle(title);
|
setNewTitle(title);
|
||||||
setEditTitle(true);
|
setEditTitle(true);
|
||||||
}}
|
}}
|
||||||
|
style={titleStyle}
|
||||||
>
|
>
|
||||||
{displayTitle}
|
{displayTitle}
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -176,19 +176,24 @@ export function LocationContainer() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="loc-metacontainer">
|
<div>
|
||||||
{containers}
|
{!isLoading && spoolData.data.length == 0 && (
|
||||||
<div className="newLocContainer">
|
<div className="no-locations">{t("locations.no_locations_help")}</div>
|
||||||
<Button
|
)}
|
||||||
type="dashed"
|
<div className="loc-metacontainer">
|
||||||
shape="circle"
|
{containers}
|
||||||
icon={<PlusOutlined />}
|
<div className="newLocContainer">
|
||||||
size="large"
|
<Button
|
||||||
style={{
|
type="dashed"
|
||||||
margin: "1em",
|
shape="circle"
|
||||||
}}
|
icon={<PlusOutlined />}
|
||||||
onClick={addNewLocation}
|
size="large"
|
||||||
/>
|
style={{
|
||||||
|
margin: "1em",
|
||||||
|
}}
|
||||||
|
onClick={addNewLocation}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { IResourceComponentsProps } from "@refinedev/core";
|
import { IResourceComponentsProps, useTranslate } from "@refinedev/core";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import utc from "dayjs/plugin/utc";
|
import utc from "dayjs/plugin/utc";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
@@ -11,10 +11,14 @@ import "./locations.css";
|
|||||||
dayjs.extend(utc);
|
dayjs.extend(utc);
|
||||||
|
|
||||||
export const Locations: React.FC<IResourceComponentsProps> = () => {
|
export const Locations: React.FC<IResourceComponentsProps> = () => {
|
||||||
|
const t = useTranslate();
|
||||||
return (
|
return (
|
||||||
<DndProvider backend={HTML5Backend}>
|
<div>
|
||||||
<LocationContainer />
|
<h1>{t("locations.locations")}</h1>
|
||||||
</DndProvider>
|
<DndProvider backend={HTML5Backend}>
|
||||||
|
<LocationContainer />
|
||||||
|
</DndProvider>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user