fix: shortened datetimes and set background color for navbar
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
import { MRT_ColumnDef } from "mantine-react-table";
|
import { MRT_ColumnDef } from "mantine-react-table";
|
||||||
import { DealSchema } from "@/lib/client";
|
import { DealSchema } from "@/lib/client";
|
||||||
|
import { utcDateTimeToLocalString } from "@/utils/datetime";
|
||||||
|
|
||||||
const useDealsTableColumns = () => {
|
const useDealsTableColumns = () => {
|
||||||
return useMemo<MRT_ColumnDef<DealSchema>[]>(
|
return useMemo<MRT_ColumnDef<DealSchema>[]>(
|
||||||
@ -19,7 +20,7 @@ const useDealsTableColumns = () => {
|
|||||||
header: "Дата создания",
|
header: "Дата создания",
|
||||||
accessorKey: "createdAt",
|
accessorKey: "createdAt",
|
||||||
Cell: ({ row }) =>
|
Cell: ({ row }) =>
|
||||||
new Date(row.original.createdAt).toLocaleString("ru-RU"),
|
utcDateTimeToLocalString(row.original.createdAt),
|
||||||
enableSorting: true,
|
enableSorting: true,
|
||||||
sortingFn: (rowA, rowB) =>
|
sortingFn: (rowA, rowB) =>
|
||||||
new Date(rowB.original.createdAt).getTime() -
|
new Date(rowB.original.createdAt).getTime() -
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { IconCircleDotted, IconLayoutKanban } from "@tabler/icons-react";
|
import { IconCircleDotted, IconLayoutKanban } from "@tabler/icons-react";
|
||||||
import { Flex } from "@mantine/core";
|
import { Box, Flex } from "@mantine/core";
|
||||||
import PageBlock from "@/components/layout/PageBlock/PageBlock";
|
import PageBlock from "@/components/layout/PageBlock/PageBlock";
|
||||||
import { ColorSchemeToggle } from "@/components/ui/ColorSchemeToggle/ColorSchemeToggle";
|
import { ColorSchemeToggle } from "@/components/ui/ColorSchemeToggle/ColorSchemeToggle";
|
||||||
import Logo from "@/components/ui/Logo/Logo";
|
import Logo from "@/components/ui/Logo/Logo";
|
||||||
@ -20,26 +20,28 @@ const linksData = [
|
|||||||
|
|
||||||
const Navbar = () => {
|
const Navbar = () => {
|
||||||
return (
|
return (
|
||||||
<PageBlock
|
<Box style={{ backgroundColor: "var(--color-light-gray-blue)" }}>
|
||||||
style={{
|
<PageBlock
|
||||||
marginBlock: "var(--mantine-spacing-md)",
|
style={{
|
||||||
marginLeft: "var(--mantine-spacing-md)",
|
marginBlock: "var(--mantine-spacing-md)",
|
||||||
}}
|
marginLeft: "var(--mantine-spacing-md)",
|
||||||
fullHeight>
|
}}
|
||||||
<Flex
|
fullHeight>
|
||||||
direction={"column"}
|
|
||||||
h={"100%"}>
|
|
||||||
<Logo title={"Fulfillment & Delivery"} />
|
|
||||||
<Flex
|
<Flex
|
||||||
mx={"xs"}
|
|
||||||
direction={"column"}
|
direction={"column"}
|
||||||
justify={"space-between"}
|
|
||||||
h={"100%"}>
|
h={"100%"}>
|
||||||
<NavbarLinks linksData={linksData} />
|
<Logo title={"Fulfillment & Delivery"} />
|
||||||
<ColorSchemeToggle />
|
<Flex
|
||||||
|
mx={"xs"}
|
||||||
|
direction={"column"}
|
||||||
|
justify={"space-between"}
|
||||||
|
h={"100%"}>
|
||||||
|
<NavbarLinks linksData={linksData} />
|
||||||
|
<ColorSchemeToggle />
|
||||||
|
</Flex>
|
||||||
</Flex>
|
</Flex>
|
||||||
</Flex>
|
</PageBlock>
|
||||||
</PageBlock>
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,10 @@ export const localDateTimeToString = (datetime: string | Date) => {
|
|||||||
return date.toLocaleString("ru").substring(0, 17);
|
return date.toLocaleString("ru").substring(0, 17);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const utcDateTimeToLocalString = (datetime: string | Date) => {
|
export const utcDateTimeToLocalString = (
|
||||||
return localDateTimeToString(utcDateToLocal(datetime));
|
datetime: string | Date,
|
||||||
|
withSeconds: boolean = false
|
||||||
|
) => {
|
||||||
|
const res = localDateTimeToString(utcDateToLocal(datetime));
|
||||||
|
return withSeconds ? res : res.substring(0, 17);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user