Skip to content

Commit d38111e

Browse files
authored
Merge pull request #401 from Leo-Corporation/vNext
Version 1.8.0.2405
2 parents 0abfd99 + 9d2fa1c commit d38111e

18 files changed

+541
-150
lines changed

components/history-card.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ export default function HistoryItem(props: {
147147
<DialogTrigger>
148148
<Image
149149
width={150}
150-
height={150}
151-
className="max-w-[150px]"
150+
height={isQrCode(props.item.bcid) ? 150 : 65}
151+
className={`max-w-[150px] object-contain ${isQrCode(props.item.bcid) ? "" : "h-[65px]"}`}
152152
src={url}
153153
alt={props.item.text}
154154
/>
@@ -188,7 +188,7 @@ export default function HistoryItem(props: {
188188
<Image
189189
width={150}
190190
height={150}
191-
className="max-w-[150px]"
191+
className={`max-w-[150px] object-contain ${isQrCode(props.item.bcid) ? "" : "h-[65px]"}`}
192192
src={url}
193193
alt={props.item.text}
194194
/>

components/ui/calendar.tsx

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
"use client";
2+
3+
import * as React from "react";
4+
import { DayPicker } from "react-day-picker";
5+
6+
import { cn } from "@/lib/utils";
7+
import { buttonVariants } from "@/components/ui/button";
8+
import {
9+
ChevronLeft16Regular,
10+
ChevronRight16Regular,
11+
} from "@fluentui/react-icons";
12+
13+
export type CalendarProps = React.ComponentProps<typeof DayPicker>;
14+
15+
function Calendar({
16+
className,
17+
classNames,
18+
showOutsideDays = true,
19+
...props
20+
}: CalendarProps) {
21+
return (
22+
<DayPicker
23+
showOutsideDays={showOutsideDays}
24+
className={cn("p-3", className)}
25+
classNames={{
26+
months: "flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",
27+
month: "space-y-4",
28+
caption: "flex justify-center pt-1 relative items-center",
29+
caption_label: "text-sm font-medium",
30+
nav: "space-x-1 flex items-center",
31+
nav_button: cn(
32+
buttonVariants({ variant: "outline" }),
33+
"h-7 w-7 bg-transparent p-0 flex justify-center opacity-50 hover:opacity-100",
34+
),
35+
nav_button_previous: "absolute left-1",
36+
nav_button_next: "absolute right-1",
37+
table: "w-full border-collapse space-y-1",
38+
head_row: "flex",
39+
head_cell:
40+
"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",
41+
row: "flex w-full mt-2",
42+
cell: "h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",
43+
day: cn(
44+
buttonVariants({ variant: "ghost" }),
45+
"h-9 w-9 p-0 flex justify-center font-normal hover:bg-slate-100 dark:hover:bg-slate-800 aria-selected:bg-accent-color aria-selected:text-white aria-selected:opacity-100",
46+
),
47+
day_range_end: "day-range-end",
48+
day_selected: "bg-primary text-white hover:bg-primary hover:text-white",
49+
day_today: "bg-accent-color/20 text-accent-foreground",
50+
day_outside:
51+
"day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",
52+
day_disabled: "text-muted-foreground opacity-50",
53+
day_range_middle:
54+
"aria-selected:bg-accent aria-selected:text-accent-foreground",
55+
day_hidden: "invisible",
56+
...classNames,
57+
}}
58+
components={{
59+
IconLeft: ({ ...props }) => (
60+
<ChevronLeft16Regular className="h-4 w-4" />
61+
),
62+
IconRight: ({ ...props }) => (
63+
<ChevronRight16Regular className="h-4 w-4" />
64+
),
65+
}}
66+
{...props}
67+
/>
68+
);
69+
}
70+
Calendar.displayName = "Calendar";
71+
72+
export { Calendar };

components/ui/command.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ const CommandItem = React.forwardRef<
120120
<CommandPrimitive.Item
121121
ref={ref}
122122
className={cn(
123-
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50",
123+
"relative flex cursor-default select-none items-center rounded-md border border-transparent px-2 py-1.5 text-sm outline-none transition-all duration-200 hover:border-slate-200 hover:bg-slate-200 aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 dark:hover:border-slate-600 dark:hover:bg-slate-800",
124124
className,
125125
)}
126126
{...props}

components/ui/date-picker.tsx

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
"use client";
2+
3+
import * as React from "react";
4+
import { format } from "date-fns";
5+
6+
import { cn } from "@/lib/utils";
7+
import { Button } from "@/components/ui/button";
8+
import { Calendar } from "@/components/ui/calendar";
9+
import {
10+
Popover,
11+
PopoverContent,
12+
PopoverTrigger,
13+
} from "@/components/ui/popover";
14+
import { Calendar16Regular } from "@fluentui/react-icons";
15+
import useTranslation from "next-translate/useTranslation";
16+
17+
export function DatePicker(props: { setDate: Function }) {
18+
const [date, setDate] = React.useState<Date>();
19+
const { t } = useTranslation("common");
20+
return (
21+
<Popover>
22+
<PopoverTrigger asChild>
23+
<Button
24+
variant={"outline"}
25+
className={cn(
26+
"justify-start border border-slate-300 text-left font-normal dark:border-slate-600",
27+
!date && "text-muted-foreground",
28+
)}
29+
>
30+
<Calendar16Regular className="mr-2 h-4 w-4" />
31+
{date ? format(date, "PPP") : <span>{t("select-date")}</span>}
32+
</Button>
33+
</PopoverTrigger>
34+
<PopoverContent className="w-auto p-0 dark:border-slate-600">
35+
<Calendar
36+
mode="single"
37+
selected={date}
38+
onSelect={(d) => {
39+
setDate(d);
40+
props.setDate(`${formatDate(d)}`);
41+
}}
42+
initialFocus
43+
/>
44+
</PopoverContent>
45+
</Popover>
46+
);
47+
}
48+
function formatDate(date: Date | undefined) {
49+
if (!date) return "";
50+
var year = date.getFullYear();
51+
var month = (1 + date.getMonth()).toString().padStart(2, "0");
52+
var day = date.getDate().toString().padStart(2, "0");
53+
54+
return year + month + day;
55+
}

components/ui/select.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const SelectContent = React.forwardRef<
4343
<SelectPrimitive.Content
4444
ref={ref}
4545
className={cn(
46-
"relative z-50 min-w-[8rem] overflow-hidden rounded-md border border-slate-200 bg-white text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 dark:border-slate-700 dark:bg-slate-800",
46+
"relative z-50 min-w-[8rem] overflow-hidden rounded-md border border-slate-200 bg-white text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 dark:border-slate-700 dark:bg-slate-900",
4747
position === "popper" &&
4848
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
4949
className,
@@ -84,7 +84,7 @@ const SelectItem = React.forwardRef<
8484
<SelectPrimitive.Item
8585
ref={ref}
8686
className={cn(
87-
"relative flex w-full cursor-default select-none items-center rounded-sm bg-white py-1.5 pl-8 pr-2 text-sm outline-none hover:bg-white focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:bg-slate-800 dark:hover:bg-slate-700",
87+
"relative flex w-full cursor-default select-none items-center rounded-md border border-transparent bg-white py-1.5 pl-8 pr-2 text-sm outline-none transition-all duration-200 hover:border-slate-200 hover:bg-slate-200 focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:bg-slate-900 dark:hover:border-slate-600 dark:hover:bg-slate-800",
8888
className,
8989
)}
9090
{...props}

lib/barcodeTypes.ts

+4
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ export const barcodeTypes = [
3535
value: "code93ext",
3636
label: "Code93 Extended",
3737
},
38+
{
39+
value: "datamatrix",
40+
label: "DataMatrix",
41+
},
3842
{
3943
value: "ean13",
4044
label: "EAN-13",

lib/calendar-event.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export interface CalendarEvent {
2+
title: string;
3+
description: string;
4+
location: string;
5+
start: string; // Use YYYYMMDD format
6+
end: string; // Use YYYYMMDD format
7+
}

locales/en/common.json

+11-1
Original file line numberDiff line numberDiff line change
@@ -105,5 +105,15 @@
105105
"firstname": "First name",
106106
"lastname": "Last name",
107107
"name": "Name",
108-
"contact": "Contact"
108+
"contact": "Contact",
109+
"normal": "Normal",
110+
"inverted": "Inverted",
111+
"rotation": "Rotation",
112+
"event": "Event",
113+
"description": "Description",
114+
"start-date": "Start date",
115+
"end-date": "End date",
116+
"event-title": "Event title",
117+
"location": "Location",
118+
"select-date": "Pick a date"
109119
}

locales/fr/common.json

+11-1
Original file line numberDiff line numberDiff line change
@@ -105,5 +105,15 @@
105105
"firstname": "Prénom",
106106
"lastname": "Nom de famille",
107107
"name": "Nom",
108-
"contact": "Contact"
108+
"contact": "Contact",
109+
"normal": "Normal",
110+
"inverted": "Inversé",
111+
"rotation": "Rotation",
112+
"event": "Evènement",
113+
"description": "Description",
114+
"start-date": "Date de début",
115+
"end-date": "Date de fin",
116+
"event-title": "Titre de l'événement",
117+
"location": "Emplacement",
118+
"select-date": "Choisir une date"
109119
}

0 commit comments

Comments
 (0)