@j3m-quantum/ui 2.1.9 → 2.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1761 -377
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +271 -1
- package/dist/index.d.ts +271 -1
- package/dist/index.js +1609 -248
- package/dist/index.js.map +1 -1
- package/dist/styles/index.css +1 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var React36 = require('react');
|
|
4
4
|
var reactSlot = require('@radix-ui/react-slot');
|
|
5
5
|
var classVarianceAuthority = require('class-variance-authority');
|
|
6
6
|
var clsx = require('clsx');
|
|
@@ -72,7 +72,7 @@ function _interopNamespace(e) {
|
|
|
72
72
|
return Object.freeze(n);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
var
|
|
75
|
+
var React36__namespace = /*#__PURE__*/_interopNamespace(React36);
|
|
76
76
|
var SeparatorPrimitive__namespace = /*#__PURE__*/_interopNamespace(SeparatorPrimitive);
|
|
77
77
|
var CheckboxPrimitive__namespace = /*#__PURE__*/_interopNamespace(CheckboxPrimitive);
|
|
78
78
|
var RadioGroupPrimitive__namespace = /*#__PURE__*/_interopNamespace(RadioGroupPrimitive);
|
|
@@ -107,8 +107,8 @@ var tunnel__default = /*#__PURE__*/_interopDefault(tunnel);
|
|
|
107
107
|
// src/hooks/use-mobile.ts
|
|
108
108
|
var MOBILE_BREAKPOINT = 1024;
|
|
109
109
|
function useIsMobile() {
|
|
110
|
-
const [isMobile, setIsMobile] =
|
|
111
|
-
|
|
110
|
+
const [isMobile, setIsMobile] = React36__namespace.useState(void 0);
|
|
111
|
+
React36__namespace.useEffect(() => {
|
|
112
112
|
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
113
113
|
const onChange = () => {
|
|
114
114
|
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
@@ -196,7 +196,7 @@ var buttonVariants = classVarianceAuthority.cva(
|
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
);
|
|
199
|
-
var Button =
|
|
199
|
+
var Button = React36__namespace.forwardRef(
|
|
200
200
|
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
201
201
|
const Comp = asChild ? reactSlot.Slot : "button";
|
|
202
202
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -560,7 +560,7 @@ function Slider({
|
|
|
560
560
|
max = 100,
|
|
561
561
|
...props
|
|
562
562
|
}) {
|
|
563
|
-
const _values =
|
|
563
|
+
const _values = React36__namespace.useMemo(
|
|
564
564
|
() => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
|
|
565
565
|
[value, defaultValue, min, max]
|
|
566
566
|
);
|
|
@@ -846,7 +846,7 @@ function Toggle({
|
|
|
846
846
|
}
|
|
847
847
|
);
|
|
848
848
|
}
|
|
849
|
-
var ToggleGroupContext =
|
|
849
|
+
var ToggleGroupContext = React36__namespace.createContext({
|
|
850
850
|
size: "default",
|
|
851
851
|
variant: "default",
|
|
852
852
|
spacing: 0
|
|
@@ -883,7 +883,7 @@ function ToggleGroupItem({
|
|
|
883
883
|
size,
|
|
884
884
|
...props
|
|
885
885
|
}) {
|
|
886
|
-
const context =
|
|
886
|
+
const context = React36__namespace.useContext(ToggleGroupContext);
|
|
887
887
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
888
888
|
ToggleGroupPrimitive__namespace.Item,
|
|
889
889
|
{
|
|
@@ -913,7 +913,7 @@ function ThemeSwitch({
|
|
|
913
913
|
className,
|
|
914
914
|
size = "default"
|
|
915
915
|
}) {
|
|
916
|
-
const [isChecked, setIsChecked] =
|
|
916
|
+
const [isChecked, setIsChecked] = React36__namespace.useState(defaultChecked);
|
|
917
917
|
const isControlled = checked !== void 0;
|
|
918
918
|
const currentChecked = isControlled ? checked : isChecked;
|
|
919
919
|
const handleClick = () => {
|
|
@@ -1333,7 +1333,7 @@ function Label2({
|
|
|
1333
1333
|
);
|
|
1334
1334
|
}
|
|
1335
1335
|
var Form = reactHookForm.FormProvider;
|
|
1336
|
-
var FormFieldContext =
|
|
1336
|
+
var FormFieldContext = React36__namespace.createContext(
|
|
1337
1337
|
{}
|
|
1338
1338
|
);
|
|
1339
1339
|
var FormField = ({
|
|
@@ -1342,8 +1342,8 @@ var FormField = ({
|
|
|
1342
1342
|
return /* @__PURE__ */ jsxRuntime.jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsxRuntime.jsx(reactHookForm.Controller, { ...props }) });
|
|
1343
1343
|
};
|
|
1344
1344
|
var useFormField = () => {
|
|
1345
|
-
const fieldContext =
|
|
1346
|
-
const itemContext =
|
|
1345
|
+
const fieldContext = React36__namespace.useContext(FormFieldContext);
|
|
1346
|
+
const itemContext = React36__namespace.useContext(FormItemContext);
|
|
1347
1347
|
const { getFieldState } = reactHookForm.useFormContext();
|
|
1348
1348
|
const formState = reactHookForm.useFormState({ name: fieldContext.name });
|
|
1349
1349
|
const fieldState = getFieldState(fieldContext.name, formState);
|
|
@@ -1360,11 +1360,11 @@ var useFormField = () => {
|
|
|
1360
1360
|
...fieldState
|
|
1361
1361
|
};
|
|
1362
1362
|
};
|
|
1363
|
-
var FormItemContext =
|
|
1363
|
+
var FormItemContext = React36__namespace.createContext(
|
|
1364
1364
|
{}
|
|
1365
1365
|
);
|
|
1366
1366
|
function FormItem({ className, ...props }) {
|
|
1367
|
-
const id =
|
|
1367
|
+
const id = React36__namespace.useId();
|
|
1368
1368
|
return /* @__PURE__ */ jsxRuntime.jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1369
1369
|
"div",
|
|
1370
1370
|
{
|
|
@@ -1612,7 +1612,7 @@ function FieldError({
|
|
|
1612
1612
|
errors,
|
|
1613
1613
|
...props
|
|
1614
1614
|
}) {
|
|
1615
|
-
const content =
|
|
1615
|
+
const content = React36.useMemo(() => {
|
|
1616
1616
|
if (children) {
|
|
1617
1617
|
return children;
|
|
1618
1618
|
}
|
|
@@ -1808,7 +1808,7 @@ var cardVariants = classVarianceAuthority.cva(
|
|
|
1808
1808
|
{
|
|
1809
1809
|
variants: {
|
|
1810
1810
|
variant: {
|
|
1811
|
-
default: "bg-card border shadow-
|
|
1811
|
+
default: "bg-card border border-[var(--color-border-subtle)] shadow-[var(--j3m-shadow-default)]",
|
|
1812
1812
|
glass: [
|
|
1813
1813
|
"glass-context",
|
|
1814
1814
|
// Enables glass semantic token overrides for children
|
|
@@ -2762,8 +2762,8 @@ function CalendarDayButton({
|
|
|
2762
2762
|
modifiers,
|
|
2763
2763
|
...props
|
|
2764
2764
|
}) {
|
|
2765
|
-
const ref =
|
|
2766
|
-
|
|
2765
|
+
const ref = React36__namespace.useRef(null);
|
|
2766
|
+
React36__namespace.useEffect(() => {
|
|
2767
2767
|
if (modifiers.focused) ref.current?.focus();
|
|
2768
2768
|
}, [modifiers.focused]);
|
|
2769
2769
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2784,9 +2784,9 @@ function CalendarDayButton({
|
|
|
2784
2784
|
}
|
|
2785
2785
|
);
|
|
2786
2786
|
}
|
|
2787
|
-
var CarouselContext =
|
|
2787
|
+
var CarouselContext = React36__namespace.createContext(null);
|
|
2788
2788
|
function useCarousel() {
|
|
2789
|
-
const context =
|
|
2789
|
+
const context = React36__namespace.useContext(CarouselContext);
|
|
2790
2790
|
if (!context) {
|
|
2791
2791
|
throw new Error("useCarousel must be used within a <Carousel />");
|
|
2792
2792
|
}
|
|
@@ -2808,20 +2808,20 @@ function Carousel({
|
|
|
2808
2808
|
},
|
|
2809
2809
|
plugins
|
|
2810
2810
|
);
|
|
2811
|
-
const [canScrollPrev, setCanScrollPrev] =
|
|
2812
|
-
const [canScrollNext, setCanScrollNext] =
|
|
2813
|
-
const onSelect =
|
|
2811
|
+
const [canScrollPrev, setCanScrollPrev] = React36__namespace.useState(false);
|
|
2812
|
+
const [canScrollNext, setCanScrollNext] = React36__namespace.useState(false);
|
|
2813
|
+
const onSelect = React36__namespace.useCallback((api2) => {
|
|
2814
2814
|
if (!api2) return;
|
|
2815
2815
|
setCanScrollPrev(api2.canScrollPrev());
|
|
2816
2816
|
setCanScrollNext(api2.canScrollNext());
|
|
2817
2817
|
}, []);
|
|
2818
|
-
const scrollPrev =
|
|
2818
|
+
const scrollPrev = React36__namespace.useCallback(() => {
|
|
2819
2819
|
api?.scrollPrev();
|
|
2820
2820
|
}, [api]);
|
|
2821
|
-
const scrollNext =
|
|
2821
|
+
const scrollNext = React36__namespace.useCallback(() => {
|
|
2822
2822
|
api?.scrollNext();
|
|
2823
2823
|
}, [api]);
|
|
2824
|
-
const handleKeyDown =
|
|
2824
|
+
const handleKeyDown = React36__namespace.useCallback(
|
|
2825
2825
|
(event) => {
|
|
2826
2826
|
if (event.key === "ArrowLeft") {
|
|
2827
2827
|
event.preventDefault();
|
|
@@ -2833,11 +2833,11 @@ function Carousel({
|
|
|
2833
2833
|
},
|
|
2834
2834
|
[scrollPrev, scrollNext]
|
|
2835
2835
|
);
|
|
2836
|
-
|
|
2836
|
+
React36__namespace.useEffect(() => {
|
|
2837
2837
|
if (!api || !setApi) return;
|
|
2838
2838
|
setApi(api);
|
|
2839
2839
|
}, [api, setApi]);
|
|
2840
|
-
|
|
2840
|
+
React36__namespace.useEffect(() => {
|
|
2841
2841
|
if (!api) return;
|
|
2842
2842
|
onSelect(api);
|
|
2843
2843
|
api.on("reInit", onSelect);
|
|
@@ -2970,9 +2970,9 @@ function CarouselNext({
|
|
|
2970
2970
|
);
|
|
2971
2971
|
}
|
|
2972
2972
|
var THEMES = { light: "", dark: ".dark" };
|
|
2973
|
-
var ChartContext =
|
|
2973
|
+
var ChartContext = React36__namespace.createContext(null);
|
|
2974
2974
|
function useChart() {
|
|
2975
|
-
const context =
|
|
2975
|
+
const context = React36__namespace.useContext(ChartContext);
|
|
2976
2976
|
if (!context) {
|
|
2977
2977
|
throw new Error("useChart must be used within a <ChartContainer />");
|
|
2978
2978
|
}
|
|
@@ -2985,7 +2985,7 @@ function ChartContainer({
|
|
|
2985
2985
|
config,
|
|
2986
2986
|
...props
|
|
2987
2987
|
}) {
|
|
2988
|
-
const uniqueId =
|
|
2988
|
+
const uniqueId = React36__namespace.useId();
|
|
2989
2989
|
const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`;
|
|
2990
2990
|
return /* @__PURE__ */ jsxRuntime.jsx(ChartContext.Provider, { value: { config }, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2991
2991
|
"div",
|
|
@@ -3046,7 +3046,7 @@ function ChartTooltipContent({
|
|
|
3046
3046
|
labelKey
|
|
3047
3047
|
}) {
|
|
3048
3048
|
const { config } = useChart();
|
|
3049
|
-
const tooltipLabel =
|
|
3049
|
+
const tooltipLabel = React36__namespace.useMemo(() => {
|
|
3050
3050
|
if (hideLabel || !payload?.length) {
|
|
3051
3051
|
return null;
|
|
3052
3052
|
}
|
|
@@ -3881,7 +3881,7 @@ function StatusProgress({
|
|
|
3881
3881
|
const resolvedVariant = variant ?? getVariantFromProgress(clampedValue);
|
|
3882
3882
|
const colors = getStatusColors(resolvedVariant);
|
|
3883
3883
|
const sizes = getSizeClasses(size);
|
|
3884
|
-
const labelText =
|
|
3884
|
+
const labelText = React36__namespace.useMemo(() => {
|
|
3885
3885
|
if (currentCount !== void 0 && totalCount !== void 0) {
|
|
3886
3886
|
return `${currentCount} / ${totalCount} ${unitLabel}`;
|
|
3887
3887
|
}
|
|
@@ -3986,8 +3986,8 @@ function TooltipContent({
|
|
|
3986
3986
|
) });
|
|
3987
3987
|
}
|
|
3988
3988
|
function useDetectTheme() {
|
|
3989
|
-
const [theme, setTheme] =
|
|
3990
|
-
|
|
3989
|
+
const [theme, setTheme] = React36__namespace.useState("light");
|
|
3990
|
+
React36__namespace.useEffect(() => {
|
|
3991
3991
|
const isDark = document.documentElement.classList.contains("dark");
|
|
3992
3992
|
setTheme(isDark ? "dark" : "light");
|
|
3993
3993
|
const observer = new MutationObserver((mutations) => {
|
|
@@ -4636,7 +4636,7 @@ function CommandShortcut({
|
|
|
4636
4636
|
}
|
|
4637
4637
|
);
|
|
4638
4638
|
}
|
|
4639
|
-
var SearchTrigger =
|
|
4639
|
+
var SearchTrigger = React36__namespace.forwardRef(
|
|
4640
4640
|
({
|
|
4641
4641
|
className,
|
|
4642
4642
|
placeholder = "Search...",
|
|
@@ -4672,7 +4672,7 @@ var SearchTrigger = React30__namespace.forwardRef(
|
|
|
4672
4672
|
);
|
|
4673
4673
|
SearchTrigger.displayName = "SearchTrigger";
|
|
4674
4674
|
function useSearchShortcut(onOpen, key = "k") {
|
|
4675
|
-
|
|
4675
|
+
React36__namespace.useEffect(() => {
|
|
4676
4676
|
const down = (e) => {
|
|
4677
4677
|
if (e.key.toLowerCase() === key.toLowerCase() && (e.metaKey || e.ctrlKey)) {
|
|
4678
4678
|
e.preventDefault();
|
|
@@ -5647,9 +5647,9 @@ var SIDEBAR_WIDTH = "16rem";
|
|
|
5647
5647
|
var SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
5648
5648
|
var SIDEBAR_WIDTH_ICON = "3rem";
|
|
5649
5649
|
var SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
5650
|
-
var SidebarContext =
|
|
5650
|
+
var SidebarContext = React36__namespace.createContext(null);
|
|
5651
5651
|
function useSidebar() {
|
|
5652
|
-
const context =
|
|
5652
|
+
const context = React36__namespace.useContext(SidebarContext);
|
|
5653
5653
|
if (!context) {
|
|
5654
5654
|
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
5655
5655
|
}
|
|
@@ -5665,10 +5665,10 @@ function SidebarProvider({
|
|
|
5665
5665
|
...props
|
|
5666
5666
|
}) {
|
|
5667
5667
|
const isMobile = useIsMobile();
|
|
5668
|
-
const [openMobile, setOpenMobile] =
|
|
5669
|
-
const [_open, _setOpen] =
|
|
5668
|
+
const [openMobile, setOpenMobile] = React36__namespace.useState(false);
|
|
5669
|
+
const [_open, _setOpen] = React36__namespace.useState(defaultOpen);
|
|
5670
5670
|
const open = openProp ?? _open;
|
|
5671
|
-
const setOpen =
|
|
5671
|
+
const setOpen = React36__namespace.useCallback(
|
|
5672
5672
|
(value) => {
|
|
5673
5673
|
const openState = typeof value === "function" ? value(open) : value;
|
|
5674
5674
|
if (setOpenProp) {
|
|
@@ -5680,10 +5680,10 @@ function SidebarProvider({
|
|
|
5680
5680
|
},
|
|
5681
5681
|
[setOpenProp, open]
|
|
5682
5682
|
);
|
|
5683
|
-
const toggleSidebar =
|
|
5683
|
+
const toggleSidebar = React36__namespace.useCallback(() => {
|
|
5684
5684
|
return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
|
|
5685
5685
|
}, [isMobile, setOpen, setOpenMobile]);
|
|
5686
|
-
|
|
5686
|
+
React36__namespace.useEffect(() => {
|
|
5687
5687
|
const handleKeyDown = (event) => {
|
|
5688
5688
|
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
5689
5689
|
event.preventDefault();
|
|
@@ -5694,7 +5694,7 @@ function SidebarProvider({
|
|
|
5694
5694
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
5695
5695
|
}, [toggleSidebar]);
|
|
5696
5696
|
const state = open ? "expanded" : "collapsed";
|
|
5697
|
-
const contextValue =
|
|
5697
|
+
const contextValue = React36__namespace.useMemo(
|
|
5698
5698
|
() => ({
|
|
5699
5699
|
state,
|
|
5700
5700
|
open,
|
|
@@ -6152,7 +6152,7 @@ function SidebarMenuSkeleton({
|
|
|
6152
6152
|
showIcon = false,
|
|
6153
6153
|
...props
|
|
6154
6154
|
}) {
|
|
6155
|
-
const width =
|
|
6155
|
+
const width = React36__namespace.useMemo(() => {
|
|
6156
6156
|
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
6157
6157
|
}, []);
|
|
6158
6158
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -6250,7 +6250,8 @@ var sectionVariants = classVarianceAuthority.cva(
|
|
|
6250
6250
|
default: [
|
|
6251
6251
|
"bg-[var(--color-bg-surface)]",
|
|
6252
6252
|
"border border-[var(--color-border-subtle)]",
|
|
6253
|
-
"text-[var(--color-text-main)]"
|
|
6253
|
+
"text-[var(--color-text-main)]",
|
|
6254
|
+
"shadow-[var(--j3m-shadow-default)]"
|
|
6254
6255
|
].join(" "),
|
|
6255
6256
|
// Glass Light - frosted glass for dark or image backgrounds
|
|
6256
6257
|
"glass-light": [
|
|
@@ -6295,7 +6296,7 @@ var sectionVariants = classVarianceAuthority.cva(
|
|
|
6295
6296
|
}
|
|
6296
6297
|
);
|
|
6297
6298
|
var isGlassVariant = (variant) => variant?.startsWith("glass-") ?? false;
|
|
6298
|
-
var Section =
|
|
6299
|
+
var Section = React36__namespace.forwardRef(
|
|
6299
6300
|
({ className, variant, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6300
6301
|
"section",
|
|
6301
6302
|
{
|
|
@@ -6307,7 +6308,7 @@ var Section = React30__namespace.forwardRef(
|
|
|
6307
6308
|
)
|
|
6308
6309
|
);
|
|
6309
6310
|
Section.displayName = "Section";
|
|
6310
|
-
var SectionHeader =
|
|
6311
|
+
var SectionHeader = React36__namespace.forwardRef(
|
|
6311
6312
|
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6312
6313
|
"div",
|
|
6313
6314
|
{
|
|
@@ -6322,7 +6323,7 @@ var SectionHeader = React30__namespace.forwardRef(
|
|
|
6322
6323
|
)
|
|
6323
6324
|
);
|
|
6324
6325
|
SectionHeader.displayName = "SectionHeader";
|
|
6325
|
-
var SectionTitle =
|
|
6326
|
+
var SectionTitle = React36__namespace.forwardRef(
|
|
6326
6327
|
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6327
6328
|
"h2",
|
|
6328
6329
|
{
|
|
@@ -6336,7 +6337,7 @@ var SectionTitle = React30__namespace.forwardRef(
|
|
|
6336
6337
|
)
|
|
6337
6338
|
);
|
|
6338
6339
|
SectionTitle.displayName = "SectionTitle";
|
|
6339
|
-
var SectionDescription =
|
|
6340
|
+
var SectionDescription = React36__namespace.forwardRef(
|
|
6340
6341
|
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6341
6342
|
"p",
|
|
6342
6343
|
{
|
|
@@ -6350,7 +6351,7 @@ var SectionDescription = React30__namespace.forwardRef(
|
|
|
6350
6351
|
)
|
|
6351
6352
|
);
|
|
6352
6353
|
SectionDescription.displayName = "SectionDescription";
|
|
6353
|
-
var SectionContent =
|
|
6354
|
+
var SectionContent = React36__namespace.forwardRef(
|
|
6354
6355
|
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6355
6356
|
"div",
|
|
6356
6357
|
{
|
|
@@ -6364,7 +6365,7 @@ var SectionContent = React30__namespace.forwardRef(
|
|
|
6364
6365
|
)
|
|
6365
6366
|
);
|
|
6366
6367
|
SectionContent.displayName = "SectionContent";
|
|
6367
|
-
var SectionFooter =
|
|
6368
|
+
var SectionFooter = React36__namespace.forwardRef(
|
|
6368
6369
|
({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6369
6370
|
"div",
|
|
6370
6371
|
{
|
|
@@ -6589,7 +6590,7 @@ function SiteHeader({
|
|
|
6589
6590
|
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-[var(--header-height,3.5rem)] w-full items-center gap-[var(--j3m-spacing-s)] px-[var(--j3m-spacing-m)]", children: [
|
|
6590
6591
|
trigger,
|
|
6591
6592
|
trigger && /* @__PURE__ */ jsxRuntime.jsx(Separator, { orientation: "vertical", className: "mr-[var(--j3m-spacing-s)] h-4" }),
|
|
6592
|
-
/* @__PURE__ */ jsxRuntime.jsx(Breadcrumb, { className: "hidden sm:block", children: /* @__PURE__ */ jsxRuntime.jsx(BreadcrumbList, { children: breadcrumbs.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6593
|
+
/* @__PURE__ */ jsxRuntime.jsx(Breadcrumb, { className: "hidden sm:block", children: /* @__PURE__ */ jsxRuntime.jsx(BreadcrumbList, { children: breadcrumbs.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs(React36__namespace.Fragment, { children: [
|
|
6593
6594
|
index > 0 && /* @__PURE__ */ jsxRuntime.jsx(BreadcrumbSeparator, {}),
|
|
6594
6595
|
/* @__PURE__ */ jsxRuntime.jsx(BreadcrumbItem, { children: item.href ? /* @__PURE__ */ jsxRuntime.jsx(BreadcrumbLink, { href: item.href, children: item.label }) : /* @__PURE__ */ jsxRuntime.jsx(BreadcrumbPage, { children: item.label }) })
|
|
6595
6596
|
] }, index)) }) }),
|
|
@@ -7210,11 +7211,11 @@ function PlanningWeekCommentPopover({
|
|
|
7210
7211
|
open,
|
|
7211
7212
|
onOpenChange
|
|
7212
7213
|
}) {
|
|
7213
|
-
const [newCommentText, setNewCommentText] =
|
|
7214
|
-
const [selectedLocationId, setSelectedLocationId] =
|
|
7215
|
-
const [viewCommentsOpen, setViewCommentsOpen] =
|
|
7216
|
-
const [showAddForm, setShowAddForm] =
|
|
7217
|
-
const selectedLocation =
|
|
7214
|
+
const [newCommentText, setNewCommentText] = React36__namespace.useState("");
|
|
7215
|
+
const [selectedLocationId, setSelectedLocationId] = React36__namespace.useState("");
|
|
7216
|
+
const [viewCommentsOpen, setViewCommentsOpen] = React36__namespace.useState(true);
|
|
7217
|
+
const [showAddForm, setShowAddForm] = React36__namespace.useState(false);
|
|
7218
|
+
const selectedLocation = React36__namespace.useMemo(() => {
|
|
7218
7219
|
return locationOptions.find((opt) => opt.id === selectedLocationId);
|
|
7219
7220
|
}, [locationOptions, selectedLocationId]);
|
|
7220
7221
|
const handleSubmit = () => {
|
|
@@ -7250,7 +7251,7 @@ function PlanningWeekCommentPopover({
|
|
|
7250
7251
|
onCommentClick(comment);
|
|
7251
7252
|
}
|
|
7252
7253
|
};
|
|
7253
|
-
const
|
|
7254
|
+
const formatDate6 = (date) => {
|
|
7254
7255
|
return new Intl.DateTimeFormat("en-US", {
|
|
7255
7256
|
month: "short",
|
|
7256
7257
|
day: "numeric",
|
|
@@ -7258,8 +7259,8 @@ function PlanningWeekCommentPopover({
|
|
|
7258
7259
|
minute: "2-digit"
|
|
7259
7260
|
}).format(date);
|
|
7260
7261
|
};
|
|
7261
|
-
const prevOpenRef =
|
|
7262
|
-
|
|
7262
|
+
const prevOpenRef = React36__namespace.useRef(open);
|
|
7263
|
+
React36__namespace.useEffect(() => {
|
|
7263
7264
|
const wasOpen = prevOpenRef.current;
|
|
7264
7265
|
prevOpenRef.current = open;
|
|
7265
7266
|
if (wasOpen && !open) {
|
|
@@ -7330,7 +7331,7 @@ function PlanningWeekCommentPopover({
|
|
|
7330
7331
|
] }),
|
|
7331
7332
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
7332
7333
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-medium", children: comment.author }),
|
|
7333
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] text-muted-foreground", children:
|
|
7334
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] text-muted-foreground", children: formatDate6(comment.createdAt) })
|
|
7334
7335
|
] }),
|
|
7335
7336
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-foreground", children: comment.text })
|
|
7336
7337
|
]
|
|
@@ -7638,15 +7639,15 @@ function PlanningTable({
|
|
|
7638
7639
|
stickySupplierColumn = true,
|
|
7639
7640
|
maxHeight = "600px"
|
|
7640
7641
|
} = config;
|
|
7641
|
-
const weeks =
|
|
7642
|
+
const weeks = React36__namespace.useMemo(
|
|
7642
7643
|
() => generateWeeks(startDate, weekCount),
|
|
7643
7644
|
[startDate, weekCount]
|
|
7644
7645
|
);
|
|
7645
|
-
const currentWeekKey =
|
|
7646
|
+
const currentWeekKey = React36__namespace.useMemo(() => {
|
|
7646
7647
|
const currentWeek = weeks.find((w) => w.isCurrentWeek);
|
|
7647
7648
|
return currentWeek ? getWeekKey(currentWeek.startDate) : null;
|
|
7648
7649
|
}, [weeks]);
|
|
7649
|
-
const columnSummaryData =
|
|
7650
|
+
const columnSummaryData = React36__namespace.useMemo(() => {
|
|
7650
7651
|
const summaryMap = /* @__PURE__ */ new Map();
|
|
7651
7652
|
for (const week of weeks) {
|
|
7652
7653
|
const weekKey = getWeekKey(week.startDate);
|
|
@@ -7688,14 +7689,14 @@ function PlanningTable({
|
|
|
7688
7689
|
}
|
|
7689
7690
|
return summaryMap;
|
|
7690
7691
|
}, [weeks, suppliers]);
|
|
7691
|
-
const columns =
|
|
7692
|
+
const columns = React36__namespace.useMemo(
|
|
7692
7693
|
() => generateColumns(weeks, config, suppliers, columnSummaryData),
|
|
7693
7694
|
[weeks, config, suppliers, columnSummaryData]
|
|
7694
7695
|
);
|
|
7695
|
-
const [sorting, setSorting] =
|
|
7696
|
-
const [columnFilters, setColumnFilters] =
|
|
7697
|
-
const [columnVisibility, setColumnVisibility] =
|
|
7698
|
-
const [rowSelection, setRowSelection] =
|
|
7696
|
+
const [sorting, setSorting] = React36__namespace.useState([]);
|
|
7697
|
+
const [columnFilters, setColumnFilters] = React36__namespace.useState([]);
|
|
7698
|
+
const [columnVisibility, setColumnVisibility] = React36__namespace.useState({});
|
|
7699
|
+
const [rowSelection, setRowSelection] = React36__namespace.useState({});
|
|
7699
7700
|
const table = reactTable.useReactTable({
|
|
7700
7701
|
data: suppliers,
|
|
7701
7702
|
columns,
|
|
@@ -7719,7 +7720,7 @@ function PlanningTable({
|
|
|
7719
7720
|
}
|
|
7720
7721
|
}
|
|
7721
7722
|
});
|
|
7722
|
-
const insightMetrics =
|
|
7723
|
+
const insightMetrics = React36__namespace.useMemo(() => {
|
|
7723
7724
|
let totalProduced = 0;
|
|
7724
7725
|
let totalRequired = 0;
|
|
7725
7726
|
let totalDeliveries = 0;
|
|
@@ -7953,10 +7954,10 @@ function DeliveryCommentPopover({
|
|
|
7953
7954
|
onAddComment,
|
|
7954
7955
|
deliveryLabel
|
|
7955
7956
|
}) {
|
|
7956
|
-
const [open, setOpen] =
|
|
7957
|
-
const [newCommentText, setNewCommentText] =
|
|
7958
|
-
const [viewCommentsOpen, setViewCommentsOpen] =
|
|
7959
|
-
const [showAddForm, setShowAddForm] =
|
|
7957
|
+
const [open, setOpen] = React36__namespace.useState(false);
|
|
7958
|
+
const [newCommentText, setNewCommentText] = React36__namespace.useState("");
|
|
7959
|
+
const [viewCommentsOpen, setViewCommentsOpen] = React36__namespace.useState(true);
|
|
7960
|
+
const [showAddForm, setShowAddForm] = React36__namespace.useState(false);
|
|
7960
7961
|
const handleSubmit = () => {
|
|
7961
7962
|
if (newCommentText.trim() && onAddComment) {
|
|
7962
7963
|
onAddComment(newCommentText.trim());
|
|
@@ -7975,7 +7976,7 @@ function DeliveryCommentPopover({
|
|
|
7975
7976
|
setNewCommentText("");
|
|
7976
7977
|
}
|
|
7977
7978
|
};
|
|
7978
|
-
const
|
|
7979
|
+
const formatDate6 = (date) => {
|
|
7979
7980
|
return new Intl.DateTimeFormat("en-US", {
|
|
7980
7981
|
month: "short",
|
|
7981
7982
|
day: "numeric",
|
|
@@ -7983,8 +7984,8 @@ function DeliveryCommentPopover({
|
|
|
7983
7984
|
minute: "2-digit"
|
|
7984
7985
|
}).format(date);
|
|
7985
7986
|
};
|
|
7986
|
-
const prevOpenRef =
|
|
7987
|
-
|
|
7987
|
+
const prevOpenRef = React36__namespace.useRef(open);
|
|
7988
|
+
React36__namespace.useEffect(() => {
|
|
7988
7989
|
const wasOpen = prevOpenRef.current;
|
|
7989
7990
|
prevOpenRef.current = open;
|
|
7990
7991
|
if (wasOpen && !open) {
|
|
@@ -8021,7 +8022,7 @@ function DeliveryCommentPopover({
|
|
|
8021
8022
|
/* @__PURE__ */ jsxRuntime.jsx(CollapsibleContent2, { className: "space-y-2 pt-2", children: comments.length > 0 ? comments.map((comment) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg bg-muted/50 p-3 space-y-2", children: [
|
|
8022
8023
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
8023
8024
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-medium", children: comment.author }),
|
|
8024
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] text-muted-foreground", children:
|
|
8025
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] text-muted-foreground", children: formatDate6(comment.createdAt) })
|
|
8025
8026
|
] }),
|
|
8026
8027
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-foreground", children: comment.text })
|
|
8027
8028
|
] }, comment.id)) : /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground text-center py-2", children: "No comments yet" }) })
|
|
@@ -8096,8 +8097,8 @@ function ProductionCommentSection({
|
|
|
8096
8097
|
comments = [],
|
|
8097
8098
|
onAddComment
|
|
8098
8099
|
}) {
|
|
8099
|
-
const [showAddForm, setShowAddForm] =
|
|
8100
|
-
const [newComment, setNewComment] =
|
|
8100
|
+
const [showAddForm, setShowAddForm] = React36__namespace.useState(false);
|
|
8101
|
+
const [newComment, setNewComment] = React36__namespace.useState("");
|
|
8101
8102
|
const handleSubmit = () => {
|
|
8102
8103
|
if (newComment.trim() && onAddComment) {
|
|
8103
8104
|
onAddComment(newComment.trim());
|
|
@@ -8115,7 +8116,7 @@ function ProductionCommentSection({
|
|
|
8115
8116
|
setNewComment("");
|
|
8116
8117
|
}
|
|
8117
8118
|
};
|
|
8118
|
-
const
|
|
8119
|
+
const formatDate6 = (date) => {
|
|
8119
8120
|
return new Intl.DateTimeFormat("en-US", {
|
|
8120
8121
|
month: "short",
|
|
8121
8122
|
day: "numeric",
|
|
@@ -8127,7 +8128,7 @@ function ProductionCommentSection({
|
|
|
8127
8128
|
comments.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-2", children: comments.map((comment) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg bg-muted/50 p-2.5 space-y-1", children: [
|
|
8128
8129
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
8129
8130
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-medium", children: comment.author }),
|
|
8130
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] text-muted-foreground", children:
|
|
8131
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] text-muted-foreground", children: formatDate6(comment.createdAt) })
|
|
8131
8132
|
] }),
|
|
8132
8133
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-foreground", children: comment.text })
|
|
8133
8134
|
] }, comment.id)) }),
|
|
@@ -8282,7 +8283,7 @@ function DeliveryDetailsView({
|
|
|
8282
8283
|
onAddComment
|
|
8283
8284
|
}) {
|
|
8284
8285
|
const elements = delivery.elements ?? [];
|
|
8285
|
-
const categorizedElements =
|
|
8286
|
+
const categorizedElements = React36__namespace.useMemo(() => {
|
|
8286
8287
|
const sent = [];
|
|
8287
8288
|
const notSent = [];
|
|
8288
8289
|
const moved = [];
|
|
@@ -8650,15 +8651,15 @@ function WeekDetailDialog({
|
|
|
8650
8651
|
}) {
|
|
8651
8652
|
const production = data?.production;
|
|
8652
8653
|
const initialProduced = production?.produced ?? 0;
|
|
8653
|
-
const [producedValue, setProducedValue] =
|
|
8654
|
-
const [hasChanges, setHasChanges] =
|
|
8655
|
-
const [selectedDelivery, setSelectedDelivery] =
|
|
8656
|
-
|
|
8654
|
+
const [producedValue, setProducedValue] = React36__namespace.useState(initialProduced.toString());
|
|
8655
|
+
const [hasChanges, setHasChanges] = React36__namespace.useState(false);
|
|
8656
|
+
const [selectedDelivery, setSelectedDelivery] = React36__namespace.useState(null);
|
|
8657
|
+
React36__namespace.useEffect(() => {
|
|
8657
8658
|
const newProduced = data?.production?.produced ?? 0;
|
|
8658
8659
|
setProducedValue(newProduced.toString());
|
|
8659
8660
|
setHasChanges(false);
|
|
8660
8661
|
}, [data]);
|
|
8661
|
-
|
|
8662
|
+
React36__namespace.useEffect(() => {
|
|
8662
8663
|
if (!open) {
|
|
8663
8664
|
setSelectedDelivery(null);
|
|
8664
8665
|
}
|
|
@@ -8789,24 +8790,24 @@ function ElementProductionDialog({
|
|
|
8789
8790
|
elements,
|
|
8790
8791
|
onSave
|
|
8791
8792
|
}) {
|
|
8792
|
-
const [searchQuery, setSearchQuery] =
|
|
8793
|
-
const [selectedIds, setSelectedIds] =
|
|
8793
|
+
const [searchQuery, setSearchQuery] = React36__namespace.useState("");
|
|
8794
|
+
const [selectedIds, setSelectedIds] = React36__namespace.useState(
|
|
8794
8795
|
new Set(elements.filter((e) => e.isProduced).map((e) => e.id))
|
|
8795
8796
|
);
|
|
8796
|
-
|
|
8797
|
+
React36__namespace.useEffect(() => {
|
|
8797
8798
|
if (open) {
|
|
8798
8799
|
setSelectedIds(new Set(elements.filter((e) => e.isProduced).map((e) => e.id)));
|
|
8799
8800
|
setSearchQuery("");
|
|
8800
8801
|
}
|
|
8801
8802
|
}, [open, elements]);
|
|
8802
|
-
const filteredElements =
|
|
8803
|
+
const filteredElements = React36__namespace.useMemo(() => {
|
|
8803
8804
|
if (!searchQuery.trim()) return elements;
|
|
8804
8805
|
const query = searchQuery.toLowerCase();
|
|
8805
8806
|
return elements.filter(
|
|
8806
8807
|
(e) => e.name.toLowerCase().includes(query) || e.prefix?.toLowerCase().includes(query) || e.type?.toLowerCase().includes(query)
|
|
8807
8808
|
);
|
|
8808
8809
|
}, [elements, searchQuery]);
|
|
8809
|
-
|
|
8810
|
+
React36__namespace.useMemo(() => {
|
|
8810
8811
|
const prefixes = /* @__PURE__ */ new Set();
|
|
8811
8812
|
elements.forEach((e) => {
|
|
8812
8813
|
if (e.prefix) prefixes.add(e.prefix);
|
|
@@ -8992,10 +8993,10 @@ function DeliveryCommentPopover2({
|
|
|
8992
8993
|
onAddComment,
|
|
8993
8994
|
deliveryLabel
|
|
8994
8995
|
}) {
|
|
8995
|
-
const [open, setOpen] =
|
|
8996
|
-
const [newCommentText, setNewCommentText] =
|
|
8997
|
-
const [viewCommentsOpen, setViewCommentsOpen] =
|
|
8998
|
-
const [showAddForm, setShowAddForm] =
|
|
8996
|
+
const [open, setOpen] = React36__namespace.useState(false);
|
|
8997
|
+
const [newCommentText, setNewCommentText] = React36__namespace.useState("");
|
|
8998
|
+
const [viewCommentsOpen, setViewCommentsOpen] = React36__namespace.useState(true);
|
|
8999
|
+
const [showAddForm, setShowAddForm] = React36__namespace.useState(false);
|
|
8999
9000
|
const handleSubmit = () => {
|
|
9000
9001
|
if (newCommentText.trim() && onAddComment) {
|
|
9001
9002
|
onAddComment(newCommentText.trim());
|
|
@@ -9014,7 +9015,7 @@ function DeliveryCommentPopover2({
|
|
|
9014
9015
|
setNewCommentText("");
|
|
9015
9016
|
}
|
|
9016
9017
|
};
|
|
9017
|
-
const
|
|
9018
|
+
const formatDate6 = (date) => {
|
|
9018
9019
|
return new Intl.DateTimeFormat("en-US", {
|
|
9019
9020
|
month: "short",
|
|
9020
9021
|
day: "numeric",
|
|
@@ -9022,7 +9023,7 @@ function DeliveryCommentPopover2({
|
|
|
9022
9023
|
minute: "2-digit"
|
|
9023
9024
|
}).format(date);
|
|
9024
9025
|
};
|
|
9025
|
-
|
|
9026
|
+
React36__namespace.useEffect(() => {
|
|
9026
9027
|
if (!open) {
|
|
9027
9028
|
setShowAddForm(false);
|
|
9028
9029
|
setNewCommentText("");
|
|
@@ -9057,7 +9058,7 @@ function DeliveryCommentPopover2({
|
|
|
9057
9058
|
/* @__PURE__ */ jsxRuntime.jsx(CollapsibleContent2, { className: "space-y-2 pt-2", children: comments.length > 0 ? comments.map((comment) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg bg-muted/50 p-3 space-y-2", children: [
|
|
9058
9059
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
9059
9060
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-medium", children: comment.author }),
|
|
9060
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] text-muted-foreground", children:
|
|
9061
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] text-muted-foreground", children: formatDate6(comment.createdAt) })
|
|
9061
9062
|
] }),
|
|
9062
9063
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-foreground", children: comment.text })
|
|
9063
9064
|
] }, comment.id)) : /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground text-center py-2", children: "No comments yet" }) })
|
|
@@ -9132,8 +9133,8 @@ function ProductionCommentSection2({
|
|
|
9132
9133
|
comments = [],
|
|
9133
9134
|
onAddComment
|
|
9134
9135
|
}) {
|
|
9135
|
-
const [showAddForm, setShowAddForm] =
|
|
9136
|
-
const [newComment, setNewComment] =
|
|
9136
|
+
const [showAddForm, setShowAddForm] = React36__namespace.useState(false);
|
|
9137
|
+
const [newComment, setNewComment] = React36__namespace.useState("");
|
|
9137
9138
|
const handleSubmit = () => {
|
|
9138
9139
|
if (newComment.trim() && onAddComment) {
|
|
9139
9140
|
onAddComment(newComment.trim());
|
|
@@ -9151,7 +9152,7 @@ function ProductionCommentSection2({
|
|
|
9151
9152
|
setNewComment("");
|
|
9152
9153
|
}
|
|
9153
9154
|
};
|
|
9154
|
-
const
|
|
9155
|
+
const formatDate6 = (date) => {
|
|
9155
9156
|
return new Intl.DateTimeFormat("en-US", {
|
|
9156
9157
|
month: "short",
|
|
9157
9158
|
day: "numeric",
|
|
@@ -9163,7 +9164,7 @@ function ProductionCommentSection2({
|
|
|
9163
9164
|
comments.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-2", children: comments.map((comment) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg bg-muted/50 p-2.5 space-y-1", children: [
|
|
9164
9165
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
9165
9166
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-medium", children: comment.author }),
|
|
9166
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] text-muted-foreground", children:
|
|
9167
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] text-muted-foreground", children: formatDate6(comment.createdAt) })
|
|
9167
9168
|
] }),
|
|
9168
9169
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-foreground", children: comment.text })
|
|
9169
9170
|
] }, comment.id)) }),
|
|
@@ -9318,7 +9319,7 @@ function DeliveryDetailsView2({
|
|
|
9318
9319
|
onAddComment
|
|
9319
9320
|
}) {
|
|
9320
9321
|
const elements = delivery.elements ?? [];
|
|
9321
|
-
const categorizedElements =
|
|
9322
|
+
const categorizedElements = React36__namespace.useMemo(() => {
|
|
9322
9323
|
const sent = [];
|
|
9323
9324
|
const notSent = [];
|
|
9324
9325
|
const moved = [];
|
|
@@ -9652,10 +9653,10 @@ function WeekDetailSheet({
|
|
|
9652
9653
|
onAddProductionComment,
|
|
9653
9654
|
onAddDeliveryComment
|
|
9654
9655
|
}) {
|
|
9655
|
-
const [selectedDelivery, setSelectedDelivery] =
|
|
9656
|
-
const [productionDialogOpen, setProductionDialogOpen] =
|
|
9657
|
-
const [previousProducedCount, setPreviousProducedCount] =
|
|
9658
|
-
const productionElements =
|
|
9656
|
+
const [selectedDelivery, setSelectedDelivery] = React36__namespace.useState(null);
|
|
9657
|
+
const [productionDialogOpen, setProductionDialogOpen] = React36__namespace.useState(false);
|
|
9658
|
+
const [previousProducedCount, setPreviousProducedCount] = React36__namespace.useState(void 0);
|
|
9659
|
+
const productionElements = React36__namespace.useMemo(() => {
|
|
9659
9660
|
if (!data?.deliveries) return [];
|
|
9660
9661
|
const elements = [];
|
|
9661
9662
|
const seenIds = /* @__PURE__ */ new Set();
|
|
@@ -9679,12 +9680,12 @@ function WeekDetailSheet({
|
|
|
9679
9680
|
return elements;
|
|
9680
9681
|
}, [data?.deliveries]);
|
|
9681
9682
|
const currentProducedCount = productionElements.filter((e) => e.isProduced).length;
|
|
9682
|
-
|
|
9683
|
+
React36__namespace.useEffect(() => {
|
|
9683
9684
|
if (open && data?.deliveries) {
|
|
9684
9685
|
setPreviousProducedCount(currentProducedCount);
|
|
9685
9686
|
}
|
|
9686
9687
|
}, [open]);
|
|
9687
|
-
|
|
9688
|
+
React36__namespace.useEffect(() => {
|
|
9688
9689
|
if (!open) {
|
|
9689
9690
|
setSelectedDelivery(null);
|
|
9690
9691
|
setProductionDialogOpen(false);
|
|
@@ -9917,13 +9918,13 @@ function CalibrationWeekCell({
|
|
|
9917
9918
|
onAddClick,
|
|
9918
9919
|
...props
|
|
9919
9920
|
}) {
|
|
9920
|
-
const inputRef =
|
|
9921
|
-
const [localValue, setLocalValue] =
|
|
9921
|
+
const inputRef = React36__namespace.useRef(null);
|
|
9922
|
+
const [localValue, setLocalValue] = React36__namespace.useState(
|
|
9922
9923
|
data.entered !== null ? String(data.entered) : ""
|
|
9923
9924
|
);
|
|
9924
|
-
const [isHovered, setIsHovered] =
|
|
9925
|
-
const [isEditing, setIsEditing] =
|
|
9926
|
-
|
|
9925
|
+
const [isHovered, setIsHovered] = React36__namespace.useState(false);
|
|
9926
|
+
const [isEditing, setIsEditing] = React36__namespace.useState(false);
|
|
9927
|
+
React36__namespace.useEffect(() => {
|
|
9927
9928
|
setLocalValue(data.entered !== null ? String(data.entered) : "");
|
|
9928
9929
|
}, [data.entered]);
|
|
9929
9930
|
const unitLabel = formatCalibrationUnit(unit);
|
|
@@ -10109,11 +10110,11 @@ function CommentPopover({
|
|
|
10109
10110
|
open,
|
|
10110
10111
|
onOpenChange
|
|
10111
10112
|
}) {
|
|
10112
|
-
const [newCommentText, setNewCommentText] =
|
|
10113
|
-
const [selectedPrefixId, setSelectedPrefixId] =
|
|
10114
|
-
const [viewCommentsOpen, setViewCommentsOpen] =
|
|
10115
|
-
const [showAddForm, setShowAddForm] =
|
|
10116
|
-
const selectedPrefixName =
|
|
10113
|
+
const [newCommentText, setNewCommentText] = React36__namespace.useState("");
|
|
10114
|
+
const [selectedPrefixId, setSelectedPrefixId] = React36__namespace.useState("");
|
|
10115
|
+
const [viewCommentsOpen, setViewCommentsOpen] = React36__namespace.useState(true);
|
|
10116
|
+
const [showAddForm, setShowAddForm] = React36__namespace.useState(false);
|
|
10117
|
+
const selectedPrefixName = React36__namespace.useMemo(() => {
|
|
10117
10118
|
const prefix = availablePrefixes.find((p) => p.id === selectedPrefixId);
|
|
10118
10119
|
return prefix?.name ?? "";
|
|
10119
10120
|
}, [availablePrefixes, selectedPrefixId]);
|
|
@@ -10137,7 +10138,7 @@ function CommentPopover({
|
|
|
10137
10138
|
setNewCommentText("");
|
|
10138
10139
|
}
|
|
10139
10140
|
};
|
|
10140
|
-
const
|
|
10141
|
+
const formatDate6 = (date) => {
|
|
10141
10142
|
return new Intl.DateTimeFormat("en-US", {
|
|
10142
10143
|
month: "short",
|
|
10143
10144
|
day: "numeric",
|
|
@@ -10145,8 +10146,8 @@ function CommentPopover({
|
|
|
10145
10146
|
minute: "2-digit"
|
|
10146
10147
|
}).format(date);
|
|
10147
10148
|
};
|
|
10148
|
-
const prevOpenRef =
|
|
10149
|
-
|
|
10149
|
+
const prevOpenRef = React36__namespace.useRef(open);
|
|
10150
|
+
React36__namespace.useEffect(() => {
|
|
10150
10151
|
const wasOpen = prevOpenRef.current;
|
|
10151
10152
|
prevOpenRef.current = open;
|
|
10152
10153
|
if (wasOpen && !open) {
|
|
@@ -10205,7 +10206,7 @@ function CommentPopover({
|
|
|
10205
10206
|
),
|
|
10206
10207
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
10207
10208
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-medium", children: comment.author }),
|
|
10208
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] text-muted-foreground", children:
|
|
10209
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] text-muted-foreground", children: formatDate6(comment.createdAt) })
|
|
10209
10210
|
] }),
|
|
10210
10211
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-foreground", children: comment.text })
|
|
10211
10212
|
]
|
|
@@ -10391,7 +10392,7 @@ function CalibrationTable({
|
|
|
10391
10392
|
onAddComment,
|
|
10392
10393
|
onAddEarlierWeek
|
|
10393
10394
|
} = config;
|
|
10394
|
-
const calculatedStartDate =
|
|
10395
|
+
const calculatedStartDate = React36__namespace.useMemo(() => {
|
|
10395
10396
|
if (startDate) return startDate;
|
|
10396
10397
|
let earliest = null;
|
|
10397
10398
|
for (const prefix of prefixes) {
|
|
@@ -10412,31 +10413,31 @@ function CalibrationTable({
|
|
|
10412
10413
|
}
|
|
10413
10414
|
return earliest ?? /* @__PURE__ */ new Date();
|
|
10414
10415
|
}, [startDate, prefixes]);
|
|
10415
|
-
const [additionalWeeks, setAdditionalWeeks] =
|
|
10416
|
-
const weeks =
|
|
10416
|
+
const [additionalWeeks, setAdditionalWeeks] = React36__namespace.useState(0);
|
|
10417
|
+
const weeks = React36__namespace.useMemo(() => {
|
|
10417
10418
|
const start = new Date(calculatedStartDate);
|
|
10418
10419
|
start.setDate(start.getDate() - additionalWeeks * 7);
|
|
10419
10420
|
return generateWeeks(start, weekCount + additionalWeeks);
|
|
10420
10421
|
}, [calculatedStartDate, weekCount, additionalWeeks]);
|
|
10421
|
-
|
|
10422
|
+
React36__namespace.useMemo(() => {
|
|
10422
10423
|
const currentWeek = weeks.find((w) => w.isCurrentWeek);
|
|
10423
10424
|
return currentWeek ? getWeekKey(currentWeek.startDate) : null;
|
|
10424
10425
|
}, [weeks]);
|
|
10425
|
-
const [currentPage, setCurrentPage] =
|
|
10426
|
-
const [pageSize, setPageSize] =
|
|
10427
|
-
const [searchQuery, setSearchQuery] =
|
|
10428
|
-
const filteredPrefixes =
|
|
10426
|
+
const [currentPage, setCurrentPage] = React36__namespace.useState(0);
|
|
10427
|
+
const [pageSize, setPageSize] = React36__namespace.useState(defaultPageSize);
|
|
10428
|
+
const [searchQuery, setSearchQuery] = React36__namespace.useState("");
|
|
10429
|
+
const filteredPrefixes = React36__namespace.useMemo(() => {
|
|
10429
10430
|
if (!searchQuery) return prefixes;
|
|
10430
10431
|
const query = searchQuery.toLowerCase();
|
|
10431
10432
|
return prefixes.filter(
|
|
10432
10433
|
(p) => p.name.toLowerCase().includes(query) || p.typeCode.toLowerCase().includes(query)
|
|
10433
10434
|
);
|
|
10434
10435
|
}, [prefixes, searchQuery]);
|
|
10435
|
-
const paginatedPrefixes =
|
|
10436
|
+
const paginatedPrefixes = React36__namespace.useMemo(() => {
|
|
10436
10437
|
const start = currentPage * pageSize;
|
|
10437
10438
|
return filteredPrefixes.slice(start, start + pageSize);
|
|
10438
10439
|
}, [filteredPrefixes, currentPage, pageSize]);
|
|
10439
|
-
|
|
10440
|
+
React36__namespace.useMemo(
|
|
10440
10441
|
() => canSubmitCalibration(prefixes),
|
|
10441
10442
|
[prefixes]
|
|
10442
10443
|
);
|
|
@@ -10460,11 +10461,11 @@ function CalibrationTable({
|
|
|
10460
10461
|
}
|
|
10461
10462
|
return allComments;
|
|
10462
10463
|
};
|
|
10463
|
-
const availablePrefixes =
|
|
10464
|
+
const availablePrefixes = React36__namespace.useMemo(
|
|
10464
10465
|
() => prefixes.map((p) => ({ id: p.id, name: p.name })),
|
|
10465
10466
|
[prefixes]
|
|
10466
10467
|
);
|
|
10467
|
-
const insightMetrics =
|
|
10468
|
+
const insightMetrics = React36__namespace.useMemo(() => {
|
|
10468
10469
|
let totalCalibrated = 0;
|
|
10469
10470
|
let totalRequired = 0;
|
|
10470
10471
|
for (const prefix of prefixes) {
|
|
@@ -10505,7 +10506,7 @@ function CalibrationTable({
|
|
|
10505
10506
|
}
|
|
10506
10507
|
];
|
|
10507
10508
|
}, [prefixes]);
|
|
10508
|
-
const columnSummaryData =
|
|
10509
|
+
const columnSummaryData = React36__namespace.useMemo(() => {
|
|
10509
10510
|
const summaryMap = /* @__PURE__ */ new Map();
|
|
10510
10511
|
for (const week of weeks) {
|
|
10511
10512
|
const weekKey = getWeekKey(week.startDate);
|
|
@@ -10772,14 +10773,14 @@ function CommentDialog({
|
|
|
10772
10773
|
open,
|
|
10773
10774
|
onOpenChange
|
|
10774
10775
|
}) {
|
|
10775
|
-
const [selectedPrefixId, setSelectedPrefixId] =
|
|
10776
|
-
const [selectedWeekKey, setSelectedWeekKey] =
|
|
10777
|
-
const [commentText, setCommentText] =
|
|
10778
|
-
const currentWeek =
|
|
10776
|
+
const [selectedPrefixId, setSelectedPrefixId] = React36__namespace.useState("");
|
|
10777
|
+
const [selectedWeekKey, setSelectedWeekKey] = React36__namespace.useState("");
|
|
10778
|
+
const [commentText, setCommentText] = React36__namespace.useState("");
|
|
10779
|
+
const currentWeek = React36__namespace.useMemo(
|
|
10779
10780
|
() => weeks.find((w) => w.isCurrentWeek),
|
|
10780
10781
|
[weeks]
|
|
10781
10782
|
);
|
|
10782
|
-
|
|
10783
|
+
React36__namespace.useEffect(() => {
|
|
10783
10784
|
if (open) {
|
|
10784
10785
|
setSelectedPrefixId(prefixes[0]?.id ?? "");
|
|
10785
10786
|
setSelectedWeekKey(currentWeek ? getWeekKey(currentWeek.startDate) : weeks[0] ? getWeekKey(weeks[0].startDate) : "");
|
|
@@ -11015,7 +11016,7 @@ function generateLoadingWeek(date) {
|
|
|
11015
11016
|
const today = /* @__PURE__ */ new Date();
|
|
11016
11017
|
today.setHours(0, 0, 0, 0);
|
|
11017
11018
|
const isCurrentWeek = monday <= today && today <= friday;
|
|
11018
|
-
const
|
|
11019
|
+
const formatDate6 = (d) => {
|
|
11019
11020
|
return d.toLocaleDateString("en-US", { month: "short", day: "numeric" });
|
|
11020
11021
|
};
|
|
11021
11022
|
return {
|
|
@@ -11023,7 +11024,7 @@ function generateLoadingWeek(date) {
|
|
|
11023
11024
|
label: `W${getLoadingISOWeek(monday).toString().padStart(2, "0")}`,
|
|
11024
11025
|
startDate: monday,
|
|
11025
11026
|
endDate: friday,
|
|
11026
|
-
dateRange: `${
|
|
11027
|
+
dateRange: `${formatDate6(monday)} - ${formatDate6(friday)}`,
|
|
11027
11028
|
isCurrentWeek
|
|
11028
11029
|
};
|
|
11029
11030
|
}
|
|
@@ -11326,7 +11327,7 @@ function WeeklyLoadingView({
|
|
|
11326
11327
|
showNavigation = true,
|
|
11327
11328
|
className
|
|
11328
11329
|
}) {
|
|
11329
|
-
const [shippedOpenState, setShippedOpenState] =
|
|
11330
|
+
const [shippedOpenState, setShippedOpenState] = React36__namespace.useState({
|
|
11330
11331
|
1: false,
|
|
11331
11332
|
// Monday
|
|
11332
11333
|
2: false,
|
|
@@ -11344,7 +11345,7 @@ function WeeklyLoadingView({
|
|
|
11344
11345
|
[dayOfWeek]: !prev[dayOfWeek]
|
|
11345
11346
|
}));
|
|
11346
11347
|
};
|
|
11347
|
-
const weekDays =
|
|
11348
|
+
const weekDays = React36__namespace.useMemo(() => {
|
|
11348
11349
|
const days = [];
|
|
11349
11350
|
for (let i = 0; i < 5; i++) {
|
|
11350
11351
|
const date = dateFns.addDays(week.startDate, i);
|
|
@@ -11356,7 +11357,7 @@ function WeeklyLoadingView({
|
|
|
11356
11357
|
}
|
|
11357
11358
|
return days;
|
|
11358
11359
|
}, [week.startDate]);
|
|
11359
|
-
const deliveriesByDay =
|
|
11360
|
+
const deliveriesByDay = React36__namespace.useMemo(() => {
|
|
11360
11361
|
const grouped = /* @__PURE__ */ new Map();
|
|
11361
11362
|
for (let i = 1; i <= 5; i++) {
|
|
11362
11363
|
grouped.set(i, { pending: [], shipped: [] });
|
|
@@ -11376,7 +11377,7 @@ function WeeklyLoadingView({
|
|
|
11376
11377
|
}, [deliveries]);
|
|
11377
11378
|
const totalPendingDeliveries = deliveries.filter((d) => !isShippedDelivery(d)).length;
|
|
11378
11379
|
const totalShippedDeliveries = deliveries.filter((d) => isShippedDelivery(d)).length;
|
|
11379
|
-
const daySummaryData =
|
|
11380
|
+
const daySummaryData = React36__namespace.useMemo(() => {
|
|
11380
11381
|
const summaries = /* @__PURE__ */ new Map();
|
|
11381
11382
|
for (let i = 1; i <= 5; i++) {
|
|
11382
11383
|
const dayData = deliveriesByDay.get(i) ?? { pending: [], shipped: [] };
|
|
@@ -11730,7 +11731,7 @@ function DeliveryTimeline({ timelineState }) {
|
|
|
11730
11731
|
const state = getStateForStep(step.id);
|
|
11731
11732
|
const styles = getStepStyles(state);
|
|
11732
11733
|
const isLast = index === TIMELINE_STEPS.length - 1;
|
|
11733
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11734
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React36__namespace.Fragment, { children: [
|
|
11734
11735
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-2", children: [
|
|
11735
11736
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11736
11737
|
"div",
|
|
@@ -11865,7 +11866,7 @@ function AddCommentDialog({
|
|
|
11865
11866
|
weekId,
|
|
11866
11867
|
onAddComment
|
|
11867
11868
|
}) {
|
|
11868
|
-
const [commentText, setCommentText] =
|
|
11869
|
+
const [commentText, setCommentText] = React36__namespace.useState("");
|
|
11869
11870
|
const handleSubmit = () => {
|
|
11870
11871
|
if (commentText.trim() && onAddComment) {
|
|
11871
11872
|
onAddComment({
|
|
@@ -11890,7 +11891,7 @@ function AddCommentDialog({
|
|
|
11890
11891
|
handleSubmit();
|
|
11891
11892
|
}
|
|
11892
11893
|
};
|
|
11893
|
-
|
|
11894
|
+
React36__namespace.useEffect(() => {
|
|
11894
11895
|
if (!open) {
|
|
11895
11896
|
setCommentText("");
|
|
11896
11897
|
}
|
|
@@ -11953,9 +11954,9 @@ function CommentsSection({
|
|
|
11953
11954
|
weekId,
|
|
11954
11955
|
onAddComment
|
|
11955
11956
|
}) {
|
|
11956
|
-
const [viewCommentsOpen, setViewCommentsOpen] =
|
|
11957
|
-
const [addDialogOpen, setAddDialogOpen] =
|
|
11958
|
-
const
|
|
11957
|
+
const [viewCommentsOpen, setViewCommentsOpen] = React36__namespace.useState(true);
|
|
11958
|
+
const [addDialogOpen, setAddDialogOpen] = React36__namespace.useState(false);
|
|
11959
|
+
const formatDate6 = (date) => {
|
|
11959
11960
|
return new Intl.DateTimeFormat("en-US", {
|
|
11960
11961
|
month: "short",
|
|
11961
11962
|
day: "numeric",
|
|
@@ -11999,7 +12000,7 @@ function CommentsSection({
|
|
|
11999
12000
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-medium", children: comment.author }),
|
|
12000
12001
|
comment.supplierName && /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "outline", className: "text-[9px] px-1.5 py-0 h-4", children: comment.prefixName ? `${comment.supplierName} - ${comment.prefixName}` : comment.supplierName })
|
|
12001
12002
|
] }),
|
|
12002
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] text-muted-foreground", children:
|
|
12003
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] text-muted-foreground", children: formatDate6(comment.createdAt) })
|
|
12003
12004
|
] }),
|
|
12004
12005
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm", children: comment.text })
|
|
12005
12006
|
] }, comment.id)) })
|
|
@@ -12028,7 +12029,7 @@ function DeliveryDetailPage({
|
|
|
12028
12029
|
onConfirmLoad
|
|
12029
12030
|
}) {
|
|
12030
12031
|
const timelineState = getTimelineState(delivery);
|
|
12031
|
-
const elementsByStatus =
|
|
12032
|
+
const elementsByStatus = React36__namespace.useMemo(() => {
|
|
12032
12033
|
const loaded = delivery.elements.filter((e) => e.status === "loaded");
|
|
12033
12034
|
const missing = delivery.elements.filter((e) => e.status === "missing");
|
|
12034
12035
|
const moved = delivery.elements.filter((e) => e.status === "moved");
|
|
@@ -12215,11 +12216,11 @@ function SupplierWeeklyLoading({
|
|
|
12215
12216
|
bordered = true,
|
|
12216
12217
|
className
|
|
12217
12218
|
}) {
|
|
12218
|
-
const [selectedDelivery, setSelectedDelivery] =
|
|
12219
|
-
const [sheetOpen, setSheetOpen] =
|
|
12220
|
-
const [commentDelivery, setCommentDelivery] =
|
|
12221
|
-
const [commentDialogOpen, setCommentDialogOpen] =
|
|
12222
|
-
const [commentText, setCommentText] =
|
|
12219
|
+
const [selectedDelivery, setSelectedDelivery] = React36__namespace.useState(null);
|
|
12220
|
+
const [sheetOpen, setSheetOpen] = React36__namespace.useState(false);
|
|
12221
|
+
const [commentDelivery, setCommentDelivery] = React36__namespace.useState(null);
|
|
12222
|
+
const [commentDialogOpen, setCommentDialogOpen] = React36__namespace.useState(false);
|
|
12223
|
+
const [commentText, setCommentText] = React36__namespace.useState("");
|
|
12223
12224
|
const handleDeliveryClick = (delivery) => {
|
|
12224
12225
|
setSelectedDelivery(delivery);
|
|
12225
12226
|
setSheetOpen(true);
|
|
@@ -12262,7 +12263,7 @@ function SupplierWeeklyLoading({
|
|
|
12262
12263
|
handleCommentSubmit();
|
|
12263
12264
|
}
|
|
12264
12265
|
};
|
|
12265
|
-
const insightMetrics =
|
|
12266
|
+
const insightMetrics = React36__namespace.useMemo(() => {
|
|
12266
12267
|
const totalDeliveries = deliveries.length;
|
|
12267
12268
|
const readyDeliveries = deliveries.filter((d) => d.isReadyToUnload).length;
|
|
12268
12269
|
deliveries.filter(
|
|
@@ -12681,11 +12682,11 @@ function CapacityPlanningChart({
|
|
|
12681
12682
|
allowDragDrop = true,
|
|
12682
12683
|
className
|
|
12683
12684
|
}) {
|
|
12684
|
-
const containerRef =
|
|
12685
|
-
const [draggedPackage, setDraggedPackage] =
|
|
12686
|
-
const [showUnassigned, setShowUnassigned] =
|
|
12687
|
-
const [containerWidth, setContainerWidth] =
|
|
12688
|
-
|
|
12685
|
+
const containerRef = React36__namespace.useRef(null);
|
|
12686
|
+
const [draggedPackage, setDraggedPackage] = React36__namespace.useState(null);
|
|
12687
|
+
const [showUnassigned, setShowUnassigned] = React36__namespace.useState(true);
|
|
12688
|
+
const [containerWidth, setContainerWidth] = React36__namespace.useState(0);
|
|
12689
|
+
React36__namespace.useEffect(() => {
|
|
12689
12690
|
const updateWidth = () => {
|
|
12690
12691
|
if (containerRef.current) {
|
|
12691
12692
|
setContainerWidth(containerRef.current.offsetWidth);
|
|
@@ -12698,15 +12699,15 @@ function CapacityPlanningChart({
|
|
|
12698
12699
|
}
|
|
12699
12700
|
return () => observer.disconnect();
|
|
12700
12701
|
}, []);
|
|
12701
|
-
const cumulativeNeed =
|
|
12702
|
+
const cumulativeNeed = React36__namespace.useMemo(
|
|
12702
12703
|
() => calculateCumulativeNeed(weeks, deliveries),
|
|
12703
12704
|
[weeks, deliveries]
|
|
12704
12705
|
);
|
|
12705
|
-
const packagePositions =
|
|
12706
|
+
const packagePositions = React36__namespace.useMemo(
|
|
12706
12707
|
() => calculatePackagePositions(packages, weeks),
|
|
12707
12708
|
[packages, weeks]
|
|
12708
12709
|
);
|
|
12709
|
-
const deliveriesByWeek =
|
|
12710
|
+
const deliveriesByWeek = React36__namespace.useMemo(() => {
|
|
12710
12711
|
const map = /* @__PURE__ */ new Map();
|
|
12711
12712
|
for (const d of deliveries) {
|
|
12712
12713
|
const existing = map.get(d.weekKey) || [];
|
|
@@ -13243,7 +13244,7 @@ var calculateInnerOffset = (date, range, columnWidth) => {
|
|
|
13243
13244
|
const dayOfMonth = date.getDate();
|
|
13244
13245
|
return dayOfMonth / totalRangeDays * columnWidth;
|
|
13245
13246
|
};
|
|
13246
|
-
var GanttContext =
|
|
13247
|
+
var GanttContext = React36.createContext({
|
|
13247
13248
|
zoom: 100,
|
|
13248
13249
|
range: "monthly",
|
|
13249
13250
|
columnWidth: 50,
|
|
@@ -13259,13 +13260,13 @@ var GanttContext = React30.createContext({
|
|
|
13259
13260
|
setGroupExpanded: () => {
|
|
13260
13261
|
}
|
|
13261
13262
|
});
|
|
13262
|
-
var useGanttContext = () =>
|
|
13263
|
+
var useGanttContext = () => React36.useContext(GanttContext);
|
|
13263
13264
|
var GanttContentHeader = ({
|
|
13264
13265
|
title,
|
|
13265
13266
|
columns,
|
|
13266
13267
|
renderHeaderItem
|
|
13267
13268
|
}) => {
|
|
13268
|
-
const id =
|
|
13269
|
+
const id = React36.useId();
|
|
13269
13270
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
13270
13271
|
"div",
|
|
13271
13272
|
{
|
|
@@ -13313,8 +13314,8 @@ var getWeekStartDate = (year, weekNumber) => {
|
|
|
13313
13314
|
return dateFns.addWeeks(week1Start, weekNumber - 1);
|
|
13314
13315
|
};
|
|
13315
13316
|
var WeeklyHeader = () => {
|
|
13316
|
-
const gantt =
|
|
13317
|
-
const weeklyData =
|
|
13317
|
+
const gantt = React36.useContext(GanttContext);
|
|
13318
|
+
const weeklyData = React36.useMemo(() => {
|
|
13318
13319
|
const result = [];
|
|
13319
13320
|
for (const yearData of gantt.timelineData) {
|
|
13320
13321
|
const year = yearData.year;
|
|
@@ -13349,7 +13350,7 @@ var WeeklyHeader = () => {
|
|
|
13349
13350
|
] }, yearData.year));
|
|
13350
13351
|
};
|
|
13351
13352
|
var MonthlyHeader = () => {
|
|
13352
|
-
const gantt =
|
|
13353
|
+
const gantt = React36.useContext(GanttContext);
|
|
13353
13354
|
return gantt.timelineData.map((year) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex flex-col", children: [
|
|
13354
13355
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13355
13356
|
GanttContentHeader,
|
|
@@ -13368,7 +13369,7 @@ var MonthlyHeader = () => {
|
|
|
13368
13369
|
] }, year.year));
|
|
13369
13370
|
};
|
|
13370
13371
|
var QuarterlyHeader = () => {
|
|
13371
|
-
const gantt =
|
|
13372
|
+
const gantt = React36.useContext(GanttContext);
|
|
13372
13373
|
return gantt.timelineData.map(
|
|
13373
13374
|
(year) => year.quarters.map((quarter, quarterIndex) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
13374
13375
|
"div",
|
|
@@ -13396,7 +13397,7 @@ var headers = {
|
|
|
13396
13397
|
quarterly: QuarterlyHeader
|
|
13397
13398
|
};
|
|
13398
13399
|
var GanttHeader = ({ className }) => {
|
|
13399
|
-
const gantt =
|
|
13400
|
+
const gantt = React36.useContext(GanttContext);
|
|
13400
13401
|
const Header2 = headers[gantt.range];
|
|
13401
13402
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
13402
13403
|
"div",
|
|
@@ -13414,7 +13415,7 @@ var GanttSidebarItem = ({
|
|
|
13414
13415
|
onSelectItem,
|
|
13415
13416
|
className
|
|
13416
13417
|
}) => {
|
|
13417
|
-
const gantt =
|
|
13418
|
+
const gantt = React36.useContext(GanttContext);
|
|
13418
13419
|
const tempEndAt = feature.endAt && dateFns.isSameDay(feature.startAt, feature.endAt) ? dateFns.addDays(feature.endAt, 1) : feature.endAt;
|
|
13419
13420
|
const duration = tempEndAt ? dateFns.formatDistance(feature.startAt, tempEndAt) : `${dateFns.formatDistance(feature.startAt, /* @__PURE__ */ new Date())} so far`;
|
|
13420
13421
|
const handleClick = (event) => {
|
|
@@ -13490,24 +13491,24 @@ function computeGroupRange(features) {
|
|
|
13490
13491
|
}
|
|
13491
13492
|
return { start: minStart, end: maxEnd };
|
|
13492
13493
|
}
|
|
13493
|
-
var GanttGroupSummaryBar =
|
|
13494
|
+
var GanttGroupSummaryBar = React36.memo(({
|
|
13494
13495
|
group,
|
|
13495
13496
|
className
|
|
13496
13497
|
}) => {
|
|
13497
|
-
const gantt =
|
|
13498
|
-
const timelineStartDate =
|
|
13498
|
+
const gantt = React36.useContext(GanttContext);
|
|
13499
|
+
const timelineStartDate = React36.useMemo(
|
|
13499
13500
|
() => new Date(gantt.timelineData.at(0)?.year ?? 0, 0, 1),
|
|
13500
13501
|
[gantt.timelineData]
|
|
13501
13502
|
);
|
|
13502
|
-
const { start: groupStart, end: groupEnd } =
|
|
13503
|
+
const { start: groupStart, end: groupEnd } = React36.useMemo(
|
|
13503
13504
|
() => computeGroupRange(group.features),
|
|
13504
13505
|
[group.features]
|
|
13505
13506
|
);
|
|
13506
|
-
const offset =
|
|
13507
|
+
const offset = React36.useMemo(() => {
|
|
13507
13508
|
if (!groupStart) return 0;
|
|
13508
13509
|
return Math.round(getOffset(groupStart, timelineStartDate, gantt));
|
|
13509
13510
|
}, [groupStart, timelineStartDate, gantt]);
|
|
13510
|
-
const width =
|
|
13511
|
+
const width = React36.useMemo(() => {
|
|
13511
13512
|
if (!groupStart || !groupEnd) return 0;
|
|
13512
13513
|
return Math.round(getWidth(groupStart, groupEnd, gantt));
|
|
13513
13514
|
}, [groupStart, groupEnd, gantt]);
|
|
@@ -13547,13 +13548,13 @@ var GanttCollapsibleSidebarGroup = ({
|
|
|
13547
13548
|
children,
|
|
13548
13549
|
className
|
|
13549
13550
|
}) => {
|
|
13550
|
-
const gantt =
|
|
13551
|
+
const gantt = React36.useContext(GanttContext);
|
|
13551
13552
|
const isExpanded = gantt.expandedGroups[group.id] ?? true;
|
|
13552
|
-
const { start: groupStart, end: groupEnd } =
|
|
13553
|
+
const { start: groupStart, end: groupEnd } = React36.useMemo(
|
|
13553
13554
|
() => computeGroupRange(group.features),
|
|
13554
13555
|
[group.features]
|
|
13555
13556
|
);
|
|
13556
|
-
const duration =
|
|
13557
|
+
const duration = React36.useMemo(() => {
|
|
13557
13558
|
if (!groupStart || !groupEnd) return null;
|
|
13558
13559
|
return dateFns.formatDistance(groupStart, groupEnd);
|
|
13559
13560
|
}, [groupStart, groupEnd]);
|
|
@@ -13597,7 +13598,7 @@ var GanttCollapsibleTimelineGroup = ({
|
|
|
13597
13598
|
children,
|
|
13598
13599
|
className
|
|
13599
13600
|
}) => {
|
|
13600
|
-
const gantt =
|
|
13601
|
+
const gantt = React36.useContext(GanttContext);
|
|
13601
13602
|
const isExpanded = gantt.expandedGroups[group.id] ?? true;
|
|
13602
13603
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
13603
13604
|
Collapsible,
|
|
@@ -13657,7 +13658,7 @@ var GanttAddFeatureHelper = ({
|
|
|
13657
13658
|
className
|
|
13658
13659
|
}) => {
|
|
13659
13660
|
const [scrollX] = useGanttScrollX();
|
|
13660
|
-
const gantt =
|
|
13661
|
+
const gantt = React36.useContext(GanttContext);
|
|
13661
13662
|
const [mousePosition, mouseRef] = usehooks.useMouse();
|
|
13662
13663
|
const handleClick = () => {
|
|
13663
13664
|
const ganttRect = gantt.ref?.current?.getBoundingClientRect();
|
|
@@ -13696,10 +13697,10 @@ var GanttColumn = ({
|
|
|
13696
13697
|
index,
|
|
13697
13698
|
isColumnSecondary
|
|
13698
13699
|
}) => {
|
|
13699
|
-
const gantt =
|
|
13700
|
+
const gantt = React36.useContext(GanttContext);
|
|
13700
13701
|
const [dragging] = useGanttDragging();
|
|
13701
13702
|
const [mousePosition, mouseRef] = usehooks.useMouse();
|
|
13702
|
-
const [hovering, setHovering] =
|
|
13703
|
+
const [hovering, setHovering] = React36.useState(false);
|
|
13703
13704
|
const [windowScroll] = usehooks.useWindowScroll();
|
|
13704
13705
|
const handleMouseEnter = () => setHovering(true);
|
|
13705
13706
|
const handleMouseLeave = () => setHovering(false);
|
|
@@ -13729,7 +13730,7 @@ var GanttColumns = ({
|
|
|
13729
13730
|
columns,
|
|
13730
13731
|
isColumnSecondary
|
|
13731
13732
|
}) => {
|
|
13732
|
-
const id =
|
|
13733
|
+
const id = React36.useId();
|
|
13733
13734
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
13734
13735
|
"div",
|
|
13735
13736
|
{
|
|
@@ -13748,12 +13749,12 @@ var GanttColumns = ({
|
|
|
13748
13749
|
}
|
|
13749
13750
|
);
|
|
13750
13751
|
};
|
|
13751
|
-
var GanttGridLines =
|
|
13752
|
+
var GanttGridLines = React36.memo(({
|
|
13752
13753
|
className
|
|
13753
13754
|
}) => {
|
|
13754
|
-
const gantt =
|
|
13755
|
-
const id =
|
|
13756
|
-
const { columns, monthBoundaryIndices } =
|
|
13755
|
+
const gantt = React36.useContext(GanttContext);
|
|
13756
|
+
const id = React36.useId();
|
|
13757
|
+
const { columns, monthBoundaryIndices } = React36.useMemo(() => {
|
|
13757
13758
|
let totalColumns = 0;
|
|
13758
13759
|
const monthIndices = [];
|
|
13759
13760
|
if (gantt.range === "weekly") {
|
|
@@ -13817,7 +13818,7 @@ var GanttCreateMarkerTrigger = ({
|
|
|
13817
13818
|
onCreateMarker,
|
|
13818
13819
|
className
|
|
13819
13820
|
}) => {
|
|
13820
|
-
const gantt =
|
|
13821
|
+
const gantt = React36.useContext(GanttContext);
|
|
13821
13822
|
const [mousePosition, mouseRef] = usehooks.useMouse();
|
|
13822
13823
|
const [windowScroll] = usehooks.useWindowScroll();
|
|
13823
13824
|
const x = usehooks.useThrottle(
|
|
@@ -13866,7 +13867,7 @@ var GanttFeatureDragHelper = ({
|
|
|
13866
13867
|
id: `feature-drag-helper-${featureId}`
|
|
13867
13868
|
});
|
|
13868
13869
|
const isPressed = Boolean(attributes["aria-pressed"]);
|
|
13869
|
-
|
|
13870
|
+
React36.useEffect(() => setDragging(isPressed), [isPressed, setDragging]);
|
|
13870
13871
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
13871
13872
|
"div",
|
|
13872
13873
|
{
|
|
@@ -13912,7 +13913,7 @@ var GanttFeatureItemCard = ({
|
|
|
13912
13913
|
const [, setDragging] = useGanttDragging();
|
|
13913
13914
|
const { attributes, listeners, setNodeRef } = core.useDraggable({ id });
|
|
13914
13915
|
const isPressed = Boolean(attributes["aria-pressed"]);
|
|
13915
|
-
|
|
13916
|
+
React36.useEffect(() => setDragging(isPressed), [isPressed, setDragging]);
|
|
13916
13917
|
return /* @__PURE__ */ jsxRuntime.jsx(Card, { className: "h-full w-full rounded-sm border bg-background px-2 py-1.5 text-xs shadow-sm overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
13917
13918
|
"div",
|
|
13918
13919
|
{
|
|
@@ -13938,37 +13939,37 @@ var GanttFeatureItem = ({
|
|
|
13938
13939
|
...feature
|
|
13939
13940
|
}) => {
|
|
13940
13941
|
const [scrollX] = useGanttScrollX();
|
|
13941
|
-
const gantt =
|
|
13942
|
-
const timelineStartDate =
|
|
13942
|
+
const gantt = React36.useContext(GanttContext);
|
|
13943
|
+
const timelineStartDate = React36.useMemo(
|
|
13943
13944
|
() => new Date(gantt.timelineData.at(0)?.year ?? 0, 0, 1),
|
|
13944
13945
|
[gantt.timelineData]
|
|
13945
13946
|
);
|
|
13946
|
-
const [startAt, setStartAt] =
|
|
13947
|
-
const [endAt, setEndAt] =
|
|
13948
|
-
const width =
|
|
13947
|
+
const [startAt, setStartAt] = React36.useState(feature.startAt);
|
|
13948
|
+
const [endAt, setEndAt] = React36.useState(feature.endAt);
|
|
13949
|
+
const width = React36.useMemo(
|
|
13949
13950
|
() => Math.round(getWidth(startAt, endAt, gantt)),
|
|
13950
13951
|
[startAt, endAt, gantt]
|
|
13951
13952
|
);
|
|
13952
|
-
const offset =
|
|
13953
|
+
const offset = React36.useMemo(
|
|
13953
13954
|
() => Math.round(getOffset(startAt, timelineStartDate, gantt)),
|
|
13954
13955
|
[startAt, timelineStartDate, gantt]
|
|
13955
13956
|
);
|
|
13956
|
-
const addRange =
|
|
13957
|
+
const addRange = React36.useMemo(() => getAddRange(gantt.range), [gantt.range]);
|
|
13957
13958
|
const [mousePosition] = usehooks.useMouse();
|
|
13958
|
-
const [previousMouseX, setPreviousMouseX] =
|
|
13959
|
-
const [previousStartAt, setPreviousStartAt] =
|
|
13960
|
-
const [previousEndAt, setPreviousEndAt] =
|
|
13959
|
+
const [previousMouseX, setPreviousMouseX] = React36.useState(0);
|
|
13960
|
+
const [previousStartAt, setPreviousStartAt] = React36.useState(startAt);
|
|
13961
|
+
const [previousEndAt, setPreviousEndAt] = React36.useState(endAt);
|
|
13961
13962
|
const mouseSensor = core.useSensor(core.MouseSensor, {
|
|
13962
13963
|
activationConstraint: {
|
|
13963
13964
|
distance: 10
|
|
13964
13965
|
}
|
|
13965
13966
|
});
|
|
13966
|
-
const handleItemDragStart =
|
|
13967
|
+
const handleItemDragStart = React36.useCallback(() => {
|
|
13967
13968
|
setPreviousMouseX(mousePosition.x);
|
|
13968
13969
|
setPreviousStartAt(startAt);
|
|
13969
13970
|
setPreviousEndAt(endAt);
|
|
13970
13971
|
}, [mousePosition.x, startAt, endAt]);
|
|
13971
|
-
const handleItemDragMove =
|
|
13972
|
+
const handleItemDragMove = React36.useCallback(() => {
|
|
13972
13973
|
const currentDate = getDateByMousePosition(gantt, mousePosition.x);
|
|
13973
13974
|
const originalDate = getDateByMousePosition(gantt, previousMouseX);
|
|
13974
13975
|
const delta = gantt.range === "weekly" ? dateFns.differenceInDays(currentDate, originalDate) : getInnerDifferenceIn(gantt.range)(currentDate, originalDate);
|
|
@@ -13977,17 +13978,17 @@ var GanttFeatureItem = ({
|
|
|
13977
13978
|
setStartAt(newStartDate);
|
|
13978
13979
|
setEndAt(newEndDate);
|
|
13979
13980
|
}, [gantt, mousePosition.x, previousMouseX, previousStartAt, previousEndAt]);
|
|
13980
|
-
const onDragEnd =
|
|
13981
|
+
const onDragEnd = React36.useCallback(
|
|
13981
13982
|
() => onMove?.(feature.id, startAt, endAt),
|
|
13982
13983
|
[onMove, feature.id, startAt, endAt]
|
|
13983
13984
|
);
|
|
13984
|
-
const handleLeftDragMove =
|
|
13985
|
+
const handleLeftDragMove = React36.useCallback(() => {
|
|
13985
13986
|
const ganttRect = gantt.ref?.current?.getBoundingClientRect();
|
|
13986
13987
|
const x = mousePosition.x - (ganttRect?.left ?? 0) + scrollX - gantt.sidebarWidth;
|
|
13987
13988
|
const newStartAt = getDateByMousePosition(gantt, x);
|
|
13988
13989
|
setStartAt(newStartAt);
|
|
13989
13990
|
}, [gantt, mousePosition.x, scrollX]);
|
|
13990
|
-
const handleRightDragMove =
|
|
13991
|
+
const handleRightDragMove = React36.useCallback(() => {
|
|
13991
13992
|
const ganttRect = gantt.ref?.current?.getBoundingClientRect();
|
|
13992
13993
|
const x = mousePosition.x - (ganttRect?.left ?? 0) + scrollX - gantt.sidebarWidth;
|
|
13993
13994
|
const newEndAt = getDateByMousePosition(gantt, x);
|
|
@@ -14183,21 +14184,21 @@ var GanttFeatureList = ({
|
|
|
14183
14184
|
children
|
|
14184
14185
|
}
|
|
14185
14186
|
);
|
|
14186
|
-
var GanttMarker =
|
|
14187
|
-
const gantt =
|
|
14188
|
-
const differenceIn =
|
|
14187
|
+
var GanttMarker = React36.memo(({ label, date, id, onRemove, className }) => {
|
|
14188
|
+
const gantt = React36.useContext(GanttContext);
|
|
14189
|
+
const differenceIn = React36.useMemo(
|
|
14189
14190
|
() => getDifferenceIn(gantt.range),
|
|
14190
14191
|
[gantt.range]
|
|
14191
14192
|
);
|
|
14192
|
-
const timelineStartDate =
|
|
14193
|
+
const timelineStartDate = React36.useMemo(
|
|
14193
14194
|
() => new Date(gantt.timelineData.at(0)?.year ?? 0, 0, 1),
|
|
14194
14195
|
[gantt.timelineData]
|
|
14195
14196
|
);
|
|
14196
|
-
const offset =
|
|
14197
|
+
const offset = React36.useMemo(
|
|
14197
14198
|
() => differenceIn(date, timelineStartDate),
|
|
14198
14199
|
[differenceIn, date, timelineStartDate]
|
|
14199
14200
|
);
|
|
14200
|
-
const innerOffset =
|
|
14201
|
+
const innerOffset = React36.useMemo(
|
|
14201
14202
|
() => calculateInnerOffset(
|
|
14202
14203
|
date,
|
|
14203
14204
|
gantt.range,
|
|
@@ -14205,7 +14206,7 @@ var GanttMarker = React30.memo(({ label, date, id, onRemove, className }) => {
|
|
|
14205
14206
|
),
|
|
14206
14207
|
[date, gantt.range, gantt.columnWidth, gantt.zoom]
|
|
14207
14208
|
);
|
|
14208
|
-
const handleRemove =
|
|
14209
|
+
const handleRemove = React36.useCallback(() => onRemove?.(id), [onRemove, id]);
|
|
14209
14210
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
14210
14211
|
"div",
|
|
14211
14212
|
{
|
|
@@ -14255,14 +14256,14 @@ var GanttProvider = ({
|
|
|
14255
14256
|
className,
|
|
14256
14257
|
defaultExpandedGroups = {}
|
|
14257
14258
|
}) => {
|
|
14258
|
-
const scrollRef =
|
|
14259
|
-
const [timelineData, setTimelineData] =
|
|
14259
|
+
const scrollRef = React36.useRef(null);
|
|
14260
|
+
const [timelineData, setTimelineData] = React36.useState(
|
|
14260
14261
|
createInitialTimelineData(/* @__PURE__ */ new Date())
|
|
14261
14262
|
);
|
|
14262
14263
|
const [, setScrollX] = useGanttScrollX();
|
|
14263
14264
|
const sidebarWidth = 280;
|
|
14264
|
-
const [expandedGroups, setExpandedGroups] =
|
|
14265
|
-
const setGroupExpanded =
|
|
14265
|
+
const [expandedGroups, setExpandedGroups] = React36.useState(defaultExpandedGroups);
|
|
14266
|
+
const setGroupExpanded = React36.useCallback((groupId, expanded) => {
|
|
14266
14267
|
setExpandedGroups((prev) => ({ ...prev, [groupId]: expanded }));
|
|
14267
14268
|
}, []);
|
|
14268
14269
|
const headerHeight = 60;
|
|
@@ -14273,7 +14274,7 @@ var GanttProvider = ({
|
|
|
14273
14274
|
} else if (range === "quarterly") {
|
|
14274
14275
|
columnWidth = 100;
|
|
14275
14276
|
}
|
|
14276
|
-
const cssVariables =
|
|
14277
|
+
const cssVariables = React36.useMemo(
|
|
14277
14278
|
() => ({
|
|
14278
14279
|
"--gantt-zoom": `${zoom}`,
|
|
14279
14280
|
"--gantt-column-width": `${zoom / 100 * columnWidth}px`,
|
|
@@ -14283,13 +14284,13 @@ var GanttProvider = ({
|
|
|
14283
14284
|
}),
|
|
14284
14285
|
[zoom, columnWidth, sidebarWidth]
|
|
14285
14286
|
);
|
|
14286
|
-
|
|
14287
|
+
React36.useEffect(() => {
|
|
14287
14288
|
if (scrollRef.current) {
|
|
14288
14289
|
scrollRef.current.scrollLeft = scrollRef.current.scrollWidth / 2 - scrollRef.current.clientWidth / 2;
|
|
14289
14290
|
setScrollX(scrollRef.current.scrollLeft);
|
|
14290
14291
|
}
|
|
14291
14292
|
}, [setScrollX]);
|
|
14292
|
-
const handleScroll =
|
|
14293
|
+
const handleScroll = React36.useCallback(
|
|
14293
14294
|
throttle__default.default(() => {
|
|
14294
14295
|
const scrollElement = scrollRef.current;
|
|
14295
14296
|
if (!scrollElement) {
|
|
@@ -14341,7 +14342,7 @@ var GanttProvider = ({
|
|
|
14341
14342
|
}, 100),
|
|
14342
14343
|
[]
|
|
14343
14344
|
);
|
|
14344
|
-
|
|
14345
|
+
React36.useEffect(() => {
|
|
14345
14346
|
const scrollElement = scrollRef.current;
|
|
14346
14347
|
if (scrollElement) {
|
|
14347
14348
|
scrollElement.addEventListener("scroll", handleScroll);
|
|
@@ -14352,7 +14353,7 @@ var GanttProvider = ({
|
|
|
14352
14353
|
}
|
|
14353
14354
|
};
|
|
14354
14355
|
}, [handleScroll]);
|
|
14355
|
-
const scrollToFeature =
|
|
14356
|
+
const scrollToFeature = React36.useCallback(
|
|
14356
14357
|
(feature) => {
|
|
14357
14358
|
const scrollElement = scrollRef.current;
|
|
14358
14359
|
if (!scrollElement) {
|
|
@@ -14432,21 +14433,21 @@ var GanttTimeline = ({
|
|
|
14432
14433
|
);
|
|
14433
14434
|
var GanttToday = ({ className }) => {
|
|
14434
14435
|
const label = "Today";
|
|
14435
|
-
const date =
|
|
14436
|
-
const gantt =
|
|
14437
|
-
const differenceIn =
|
|
14436
|
+
const date = React36.useMemo(() => /* @__PURE__ */ new Date(), []);
|
|
14437
|
+
const gantt = React36.useContext(GanttContext);
|
|
14438
|
+
const differenceIn = React36.useMemo(
|
|
14438
14439
|
() => getDifferenceIn(gantt.range),
|
|
14439
14440
|
[gantt.range]
|
|
14440
14441
|
);
|
|
14441
|
-
const timelineStartDate =
|
|
14442
|
+
const timelineStartDate = React36.useMemo(
|
|
14442
14443
|
() => new Date(gantt.timelineData.at(0)?.year ?? 0, 0, 1),
|
|
14443
14444
|
[gantt.timelineData]
|
|
14444
14445
|
);
|
|
14445
|
-
const offset =
|
|
14446
|
+
const offset = React36.useMemo(
|
|
14446
14447
|
() => differenceIn(date, timelineStartDate),
|
|
14447
14448
|
[differenceIn, date, timelineStartDate]
|
|
14448
14449
|
);
|
|
14449
|
-
const innerOffset =
|
|
14450
|
+
const innerOffset = React36.useMemo(
|
|
14450
14451
|
() => Math.round(calculateInnerOffset(
|
|
14451
14452
|
date,
|
|
14452
14453
|
gantt.range,
|
|
@@ -14538,11 +14539,11 @@ var getWeekStartDate2 = (year, weekNumber) => {
|
|
|
14538
14539
|
targetDate.setDate(week1Start.getDate() + (weekNumber - 1) * 7);
|
|
14539
14540
|
return targetDate;
|
|
14540
14541
|
};
|
|
14541
|
-
var EnhancedGridLines =
|
|
14542
|
+
var EnhancedGridLines = React36.memo(({ rowCount }) => {
|
|
14542
14543
|
const gantt = useGanttContext();
|
|
14543
|
-
const id =
|
|
14544
|
+
const id = React36__namespace.useId();
|
|
14544
14545
|
const columnWidth = gantt.columnWidth * gantt.zoom / 100;
|
|
14545
|
-
const { verticalLines, totalColumns } =
|
|
14546
|
+
const { verticalLines, totalColumns } = React36.useMemo(() => {
|
|
14546
14547
|
const lines = [];
|
|
14547
14548
|
let totalCols = 0;
|
|
14548
14549
|
if (gantt.range === "weekly") {
|
|
@@ -14582,7 +14583,7 @@ var EnhancedGridLines = React30.memo(({ rowCount }) => {
|
|
|
14582
14583
|
}
|
|
14583
14584
|
return { verticalLines: lines, totalColumns: totalCols };
|
|
14584
14585
|
}, [gantt.timelineData, gantt.range, columnWidth]);
|
|
14585
|
-
const horizontalLines =
|
|
14586
|
+
const horizontalLines = React36.useMemo(() => {
|
|
14586
14587
|
const lines = [];
|
|
14587
14588
|
for (let i = 0; i <= rowCount; i++) {
|
|
14588
14589
|
lines.push(i);
|
|
@@ -14632,7 +14633,7 @@ var EnhancedGridLines = React30.memo(({ rowCount }) => {
|
|
|
14632
14633
|
] });
|
|
14633
14634
|
});
|
|
14634
14635
|
EnhancedGridLines.displayName = "EnhancedGridLines";
|
|
14635
|
-
var DeliveryCut =
|
|
14636
|
+
var DeliveryCut = React36.memo(({
|
|
14636
14637
|
date,
|
|
14637
14638
|
packageEndDate,
|
|
14638
14639
|
packageName,
|
|
@@ -14640,19 +14641,19 @@ var DeliveryCut = React30.memo(({
|
|
|
14640
14641
|
feasibility
|
|
14641
14642
|
}) => {
|
|
14642
14643
|
const gantt = useGanttContext();
|
|
14643
|
-
const timelineStartDate =
|
|
14644
|
+
const timelineStartDate = React36.useMemo(
|
|
14644
14645
|
() => new Date(gantt.timelineData.at(0)?.year ?? 0, 0, 1),
|
|
14645
14646
|
[gantt.timelineData]
|
|
14646
14647
|
);
|
|
14647
|
-
const offset =
|
|
14648
|
+
const offset = React36.useMemo(
|
|
14648
14649
|
() => Math.round(getOffset(date, timelineStartDate, gantt)),
|
|
14649
14650
|
[date, timelineStartDate, gantt]
|
|
14650
14651
|
);
|
|
14651
|
-
const deltaDays =
|
|
14652
|
+
const deltaDays = React36.useMemo(
|
|
14652
14653
|
() => dateFns.differenceInDays(date, packageEndDate),
|
|
14653
14654
|
[date, packageEndDate]
|
|
14654
14655
|
);
|
|
14655
|
-
const colors =
|
|
14656
|
+
const colors = React36.useMemo(() => {
|
|
14656
14657
|
switch (feasibility) {
|
|
14657
14658
|
case "feasible":
|
|
14658
14659
|
return {
|
|
@@ -14681,7 +14682,7 @@ var DeliveryCut = React30.memo(({
|
|
|
14681
14682
|
};
|
|
14682
14683
|
}
|
|
14683
14684
|
}, [feasibility]);
|
|
14684
|
-
const deltaText =
|
|
14685
|
+
const deltaText = React36.useMemo(() => {
|
|
14685
14686
|
if (deltaDays > 0) {
|
|
14686
14687
|
return `+${deltaDays}d buffer`;
|
|
14687
14688
|
} else if (deltaDays < 0) {
|
|
@@ -14719,7 +14720,7 @@ var DeliveryCut = React30.memo(({
|
|
|
14719
14720
|
);
|
|
14720
14721
|
});
|
|
14721
14722
|
DeliveryCut.displayName = "DeliveryCut";
|
|
14722
|
-
var FeasibilityFeatureItem =
|
|
14723
|
+
var FeasibilityFeatureItem = React36.memo(({
|
|
14723
14724
|
feature,
|
|
14724
14725
|
pkg,
|
|
14725
14726
|
feasibility,
|
|
@@ -14730,35 +14731,35 @@ var FeasibilityFeatureItem = React30.memo(({
|
|
|
14730
14731
|
}) => {
|
|
14731
14732
|
const gantt = useGanttContext();
|
|
14732
14733
|
const [, setDragging] = useGanttDragging();
|
|
14733
|
-
const timelineStartDate =
|
|
14734
|
+
const timelineStartDate = React36.useMemo(
|
|
14734
14735
|
() => new Date(gantt.timelineData.at(0)?.year ?? 0, 0, 1),
|
|
14735
14736
|
[gantt.timelineData]
|
|
14736
14737
|
);
|
|
14737
|
-
const [startAt, setStartAt] =
|
|
14738
|
-
const [endAt, setEndAt] =
|
|
14739
|
-
const originalDuration =
|
|
14738
|
+
const [startAt, setStartAt] = React36.useState(feature.startAt);
|
|
14739
|
+
const [endAt, setEndAt] = React36.useState(feature.endAt);
|
|
14740
|
+
const originalDuration = React36.useMemo(
|
|
14740
14741
|
() => dateFns.differenceInDays(feature.endAt, feature.startAt),
|
|
14741
14742
|
[feature.endAt, feature.startAt]
|
|
14742
14743
|
);
|
|
14743
|
-
const width =
|
|
14744
|
+
const width = React36.useMemo(
|
|
14744
14745
|
() => Math.round(getWidth(startAt, endAt, gantt)),
|
|
14745
14746
|
[startAt, endAt, gantt]
|
|
14746
14747
|
);
|
|
14747
|
-
const offset =
|
|
14748
|
+
const offset = React36.useMemo(
|
|
14748
14749
|
() => Math.round(getOffset(startAt, timelineStartDate, gantt)),
|
|
14749
14750
|
[startAt, timelineStartDate, gantt]
|
|
14750
14751
|
);
|
|
14751
14752
|
const [mousePosition] = usehooks.useMouse();
|
|
14752
|
-
const [previousMouseX, setPreviousMouseX] =
|
|
14753
|
-
const [previousStartAt, setPreviousStartAt] =
|
|
14753
|
+
const [previousMouseX, setPreviousMouseX] = React36.useState(0);
|
|
14754
|
+
const [previousStartAt, setPreviousStartAt] = React36.useState(startAt);
|
|
14754
14755
|
const mouseSensor = core.useSensor(core.MouseSensor, {
|
|
14755
14756
|
activationConstraint: { distance: 10 }
|
|
14756
14757
|
});
|
|
14757
|
-
const handleDragStart =
|
|
14758
|
+
const handleDragStart = React36.useCallback(() => {
|
|
14758
14759
|
setPreviousMouseX(mousePosition.x);
|
|
14759
14760
|
setPreviousStartAt(startAt);
|
|
14760
14761
|
}, [mousePosition.x, startAt]);
|
|
14761
|
-
const handleDragMove =
|
|
14762
|
+
const handleDragMove = React36.useCallback(() => {
|
|
14762
14763
|
const currentDate = getDateByMousePosition(gantt, mousePosition.x);
|
|
14763
14764
|
const originalDate = getDateByMousePosition(gantt, previousMouseX);
|
|
14764
14765
|
const delta = dateFns.differenceInDays(currentDate, originalDate);
|
|
@@ -14767,18 +14768,18 @@ var FeasibilityFeatureItem = React30.memo(({
|
|
|
14767
14768
|
setStartAt(newStart);
|
|
14768
14769
|
setEndAt(newEnd);
|
|
14769
14770
|
}, [gantt, mousePosition.x, previousMouseX, previousStartAt, originalDuration]);
|
|
14770
|
-
const handleDragEnd =
|
|
14771
|
+
const handleDragEnd = React36.useCallback(() => {
|
|
14771
14772
|
onMove?.(feature.id, startAt, endAt);
|
|
14772
14773
|
}, [onMove, feature.id, startAt, endAt]);
|
|
14773
14774
|
const { attributes, listeners, setNodeRef, isDragging } = core.useDraggable({
|
|
14774
14775
|
id: `feature-${feature.id}`
|
|
14775
14776
|
});
|
|
14776
|
-
|
|
14777
|
+
React36.useEffect(() => setDragging(isDragging), [isDragging, setDragging]);
|
|
14777
14778
|
const color = feature.status.color;
|
|
14778
|
-
const handleMouseEnter =
|
|
14779
|
+
const handleMouseEnter = React36.useCallback(() => {
|
|
14779
14780
|
onHoverChange?.(true);
|
|
14780
14781
|
}, [onHoverChange]);
|
|
14781
|
-
const handleMouseLeave =
|
|
14782
|
+
const handleMouseLeave = React36.useCallback(() => {
|
|
14782
14783
|
onHoverChange?.(false);
|
|
14783
14784
|
}, [onHoverChange]);
|
|
14784
14785
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -14912,13 +14913,13 @@ function ProductionPackageGantt({
|
|
|
14912
14913
|
zoom = 100,
|
|
14913
14914
|
className
|
|
14914
14915
|
}) {
|
|
14915
|
-
const [packageDates, setPackageDates] =
|
|
14916
|
+
const [packageDates, setPackageDates] = React36.useState(
|
|
14916
14917
|
() => new Map(packages.map((pkg) => [pkg.id, { startDate: pkg.startDate, endDate: pkg.endDate }]))
|
|
14917
14918
|
);
|
|
14918
|
-
const [hoveredPackageId, setHoveredPackageId] =
|
|
14919
|
-
const [selectedPackage, setSelectedPackage] =
|
|
14920
|
-
const [sheetOpen, setSheetOpen] =
|
|
14921
|
-
const packageFeasibility =
|
|
14919
|
+
const [hoveredPackageId, setHoveredPackageId] = React36.useState(null);
|
|
14920
|
+
const [selectedPackage, setSelectedPackage] = React36.useState(null);
|
|
14921
|
+
const [sheetOpen, setSheetOpen] = React36.useState(false);
|
|
14922
|
+
const packageFeasibility = React36.useMemo(() => {
|
|
14922
14923
|
const result = /* @__PURE__ */ new Map();
|
|
14923
14924
|
for (const pkg of packages) {
|
|
14924
14925
|
const dates = packageDates.get(pkg.id) ?? { startDate: pkg.startDate, endDate: pkg.endDate };
|
|
@@ -14926,7 +14927,7 @@ function ProductionPackageGantt({
|
|
|
14926
14927
|
}
|
|
14927
14928
|
return result;
|
|
14928
14929
|
}, [packages, packageDates]);
|
|
14929
|
-
const ganttFeatures =
|
|
14930
|
+
const ganttFeatures = React36.useMemo(() => {
|
|
14930
14931
|
return packages.map((pkg) => {
|
|
14931
14932
|
const dates = packageDates.get(pkg.id) ?? { startDate: pkg.startDate, endDate: pkg.endDate };
|
|
14932
14933
|
const status = packageFeasibility.get(pkg.id) ?? "feasible";
|
|
@@ -14943,7 +14944,7 @@ function ProductionPackageGantt({
|
|
|
14943
14944
|
};
|
|
14944
14945
|
});
|
|
14945
14946
|
}, [packages, packageDates, packageFeasibility]);
|
|
14946
|
-
const handleFeatureMove =
|
|
14947
|
+
const handleFeatureMove = React36.useCallback((id, startAt, endAt) => {
|
|
14947
14948
|
setPackageDates((prev) => {
|
|
14948
14949
|
const next = new Map(prev);
|
|
14949
14950
|
next.set(id, { startDate: startAt, endDate: endAt });
|
|
@@ -14951,15 +14952,15 @@ function ProductionPackageGantt({
|
|
|
14951
14952
|
});
|
|
14952
14953
|
onPackageMove?.(id, startAt, endAt);
|
|
14953
14954
|
}, [onPackageMove]);
|
|
14954
|
-
const handlePackageClick =
|
|
14955
|
+
const handlePackageClick = React36.useCallback((pkg) => {
|
|
14955
14956
|
setSelectedPackage(pkg);
|
|
14956
14957
|
setSheetOpen(true);
|
|
14957
14958
|
onPackageClick?.(pkg);
|
|
14958
14959
|
}, [onPackageClick]);
|
|
14959
|
-
const handleHoverChange =
|
|
14960
|
+
const handleHoverChange = React36.useCallback((pkgId, isHovered) => {
|
|
14960
14961
|
setHoveredPackageId(isHovered ? pkgId : null);
|
|
14961
14962
|
}, []);
|
|
14962
|
-
const insightMetrics =
|
|
14963
|
+
const insightMetrics = React36.useMemo(() => {
|
|
14963
14964
|
const feasibleCount = Array.from(packageFeasibility.values()).filter((s) => s === "feasible").length;
|
|
14964
14965
|
const atRiskCount = Array.from(packageFeasibility.values()).filter((s) => s === "at-risk").length;
|
|
14965
14966
|
const infeasibleCount = Array.from(packageFeasibility.values()).filter((s) => s === "infeasible").length;
|
|
@@ -15133,11 +15134,11 @@ function getPhaseColor(phaseId, customColor) {
|
|
|
15133
15134
|
if (customColor) return customColor;
|
|
15134
15135
|
return PHASE_COLORS[phaseId] || "hsl(var(--chart-5))";
|
|
15135
15136
|
}
|
|
15136
|
-
var LightweightGridLines =
|
|
15137
|
+
var LightweightGridLines = React36.memo(() => {
|
|
15137
15138
|
const gantt = useGanttContext();
|
|
15138
|
-
const id =
|
|
15139
|
+
const id = React36__namespace.useId();
|
|
15139
15140
|
const columnWidth = gantt.columnWidth * gantt.zoom / 100;
|
|
15140
|
-
const { lines, totalWidth } =
|
|
15141
|
+
const { lines, totalWidth } = React36.useMemo(() => {
|
|
15141
15142
|
const linePositions = [];
|
|
15142
15143
|
let currentOffset = 0;
|
|
15143
15144
|
let weekCounter = 0;
|
|
@@ -15184,13 +15185,13 @@ var LightweightGridLines = React30.memo(() => {
|
|
|
15184
15185
|
);
|
|
15185
15186
|
});
|
|
15186
15187
|
LightweightGridLines.displayName = "LightweightGridLines";
|
|
15187
|
-
var DeadlineMarker =
|
|
15188
|
+
var DeadlineMarker = React36.memo(({ date, label, visible }) => {
|
|
15188
15189
|
const gantt = useGanttContext();
|
|
15189
|
-
const timelineStartDate =
|
|
15190
|
+
const timelineStartDate = React36.useMemo(
|
|
15190
15191
|
() => new Date(gantt.timelineData.at(0)?.year ?? 0, 0, 1),
|
|
15191
15192
|
[gantt.timelineData]
|
|
15192
15193
|
);
|
|
15193
|
-
const offset =
|
|
15194
|
+
const offset = React36.useMemo(
|
|
15194
15195
|
() => Math.round(getOffset(date, timelineStartDate, gantt)),
|
|
15195
15196
|
[date, timelineStartDate, gantt]
|
|
15196
15197
|
);
|
|
@@ -15234,8 +15235,8 @@ var DeadlineMarker = React30.memo(({ date, label, visible }) => {
|
|
|
15234
15235
|
);
|
|
15235
15236
|
});
|
|
15236
15237
|
DeadlineMarker.displayName = "DeadlineMarker";
|
|
15237
|
-
var PhaseIndicator =
|
|
15238
|
-
const handleClick =
|
|
15238
|
+
var PhaseIndicator = React36.memo(({ type, onClick }) => {
|
|
15239
|
+
const handleClick = React36.useCallback((e) => {
|
|
15239
15240
|
e.stopPropagation();
|
|
15240
15241
|
onClick?.(e);
|
|
15241
15242
|
}, [onClick]);
|
|
@@ -15258,18 +15259,18 @@ var PhaseIndicator = React30.memo(({ type, onClick }) => {
|
|
|
15258
15259
|
] }) });
|
|
15259
15260
|
});
|
|
15260
15261
|
PhaseIndicator.displayName = "PhaseIndicator";
|
|
15261
|
-
var PhaseBar =
|
|
15262
|
-
const [isHovered, setIsHovered] =
|
|
15262
|
+
var PhaseBar = React36.memo(({ phase, isExpanded, onToggle, hasDeadline }) => {
|
|
15263
|
+
const [isHovered, setIsHovered] = React36.useState(false);
|
|
15263
15264
|
const gantt = useGanttContext();
|
|
15264
|
-
const timelineStartDate =
|
|
15265
|
+
const timelineStartDate = React36.useMemo(
|
|
15265
15266
|
() => new Date(gantt.timelineData.at(0)?.year ?? 0, 0, 1),
|
|
15266
15267
|
[gantt.timelineData]
|
|
15267
15268
|
);
|
|
15268
|
-
const width =
|
|
15269
|
+
const width = React36.useMemo(
|
|
15269
15270
|
() => Math.round(getWidth(phase.startDate, phase.endDate, gantt)),
|
|
15270
15271
|
[phase.startDate, phase.endDate, gantt]
|
|
15271
15272
|
);
|
|
15272
|
-
const offset =
|
|
15273
|
+
const offset = React36.useMemo(
|
|
15273
15274
|
() => Math.round(getOffset(phase.startDate, timelineStartDate, gantt)),
|
|
15274
15275
|
[phase.startDate, timelineStartDate, gantt]
|
|
15275
15276
|
);
|
|
@@ -15351,17 +15352,17 @@ var PhaseBar = React30.memo(({ phase, isExpanded, onToggle, hasDeadline }) => {
|
|
|
15351
15352
|
);
|
|
15352
15353
|
});
|
|
15353
15354
|
PhaseBar.displayName = "PhaseBar";
|
|
15354
|
-
var PackageBar =
|
|
15355
|
+
var PackageBar = React36.memo(({ pkg, phaseColor, onClick }) => {
|
|
15355
15356
|
const gantt = useGanttContext();
|
|
15356
|
-
const timelineStartDate =
|
|
15357
|
+
const timelineStartDate = React36.useMemo(
|
|
15357
15358
|
() => new Date(gantt.timelineData.at(0)?.year ?? 0, 0, 1),
|
|
15358
15359
|
[gantt.timelineData]
|
|
15359
15360
|
);
|
|
15360
|
-
const width =
|
|
15361
|
+
const width = React36.useMemo(
|
|
15361
15362
|
() => Math.round(getWidth(pkg.startDate, pkg.endDate, gantt)),
|
|
15362
15363
|
[pkg.startDate, pkg.endDate, gantt]
|
|
15363
15364
|
);
|
|
15364
|
-
const offset =
|
|
15365
|
+
const offset = React36.useMemo(
|
|
15365
15366
|
() => Math.round(getOffset(pkg.startDate, timelineStartDate, gantt)),
|
|
15366
15367
|
[pkg.startDate, pkg.endDate, gantt]
|
|
15367
15368
|
);
|
|
@@ -15407,7 +15408,7 @@ var PackageBar = React30.memo(({ pkg, phaseColor, onClick }) => {
|
|
|
15407
15408
|
);
|
|
15408
15409
|
});
|
|
15409
15410
|
PackageBar.displayName = "PackageBar";
|
|
15410
|
-
var PhaseSidebarItem =
|
|
15411
|
+
var PhaseSidebarItem = React36.memo(({
|
|
15411
15412
|
phase,
|
|
15412
15413
|
packageCount,
|
|
15413
15414
|
isExpanded,
|
|
@@ -15462,7 +15463,7 @@ var PhaseSidebarItem = React30.memo(({
|
|
|
15462
15463
|
);
|
|
15463
15464
|
});
|
|
15464
15465
|
PhaseSidebarItem.displayName = "PhaseSidebarItem";
|
|
15465
|
-
var PackageSidebarItem =
|
|
15466
|
+
var PackageSidebarItem = React36.memo(({
|
|
15466
15467
|
pkg,
|
|
15467
15468
|
phaseColor,
|
|
15468
15469
|
onClick
|
|
@@ -15527,12 +15528,12 @@ function PhaseGantt({
|
|
|
15527
15528
|
className,
|
|
15528
15529
|
defaultExpandedPhases = []
|
|
15529
15530
|
}) {
|
|
15530
|
-
const [expandedPhases, setExpandedPhases] =
|
|
15531
|
+
const [expandedPhases, setExpandedPhases] = React36.useState(
|
|
15531
15532
|
() => new Set(defaultExpandedPhases)
|
|
15532
15533
|
);
|
|
15533
|
-
const [selectedPackage, setSelectedPackage] =
|
|
15534
|
-
const [sheetOpen, setSheetOpen] =
|
|
15535
|
-
const togglePhase =
|
|
15534
|
+
const [selectedPackage, setSelectedPackage] = React36.useState(null);
|
|
15535
|
+
const [sheetOpen, setSheetOpen] = React36.useState(false);
|
|
15536
|
+
const togglePhase = React36.useCallback((phaseId) => {
|
|
15536
15537
|
setExpandedPhases((prev) => {
|
|
15537
15538
|
const next = new Set(prev);
|
|
15538
15539
|
if (next.has(phaseId)) {
|
|
@@ -15543,12 +15544,12 @@ function PhaseGantt({
|
|
|
15543
15544
|
return next;
|
|
15544
15545
|
});
|
|
15545
15546
|
}, []);
|
|
15546
|
-
const handlePackageClick =
|
|
15547
|
+
const handlePackageClick = React36.useCallback((pkg) => {
|
|
15547
15548
|
setSelectedPackage(pkg);
|
|
15548
15549
|
setSheetOpen(true);
|
|
15549
15550
|
onPackageClick?.(pkg);
|
|
15550
15551
|
}, [onPackageClick]);
|
|
15551
|
-
const packagesByPhase =
|
|
15552
|
+
const packagesByPhase = React36.useMemo(() => {
|
|
15552
15553
|
const map = /* @__PURE__ */ new Map();
|
|
15553
15554
|
for (const phase of phases) {
|
|
15554
15555
|
map.set(phase.id, []);
|
|
@@ -15561,7 +15562,7 @@ function PhaseGantt({
|
|
|
15561
15562
|
}
|
|
15562
15563
|
return map;
|
|
15563
15564
|
}, [phases, packages]);
|
|
15564
|
-
const selectedPhase =
|
|
15565
|
+
const selectedPhase = React36.useMemo(() => {
|
|
15565
15566
|
if (!selectedPackage) return null;
|
|
15566
15567
|
return phases.find((p) => p.id === selectedPackage.phaseId) ?? null;
|
|
15567
15568
|
}, [selectedPackage, phases]);
|
|
@@ -15732,6 +15733,1366 @@ function PhaseGantt({
|
|
|
15732
15733
|
}
|
|
15733
15734
|
);
|
|
15734
15735
|
}
|
|
15736
|
+
function getSubtaskTypeIcon(type) {
|
|
15737
|
+
switch (type) {
|
|
15738
|
+
case "calculation":
|
|
15739
|
+
return lucideReact.Calculator;
|
|
15740
|
+
case "review":
|
|
15741
|
+
return lucideReact.FileCheck;
|
|
15742
|
+
case "upload":
|
|
15743
|
+
return lucideReact.Upload;
|
|
15744
|
+
case "approval":
|
|
15745
|
+
return lucideReact.UserCheck;
|
|
15746
|
+
case "documentation":
|
|
15747
|
+
return lucideReact.FileText;
|
|
15748
|
+
default:
|
|
15749
|
+
return lucideReact.Circle;
|
|
15750
|
+
}
|
|
15751
|
+
}
|
|
15752
|
+
function getSubtaskTypeLabel(type) {
|
|
15753
|
+
switch (type) {
|
|
15754
|
+
case "calculation":
|
|
15755
|
+
return "Calculation";
|
|
15756
|
+
case "review":
|
|
15757
|
+
return "Review";
|
|
15758
|
+
case "upload":
|
|
15759
|
+
return "Upload";
|
|
15760
|
+
case "approval":
|
|
15761
|
+
return "Approval";
|
|
15762
|
+
case "documentation":
|
|
15763
|
+
return "Documentation";
|
|
15764
|
+
default:
|
|
15765
|
+
return "Task";
|
|
15766
|
+
}
|
|
15767
|
+
}
|
|
15768
|
+
function getStatusIcon(status) {
|
|
15769
|
+
switch (status) {
|
|
15770
|
+
case "done":
|
|
15771
|
+
return lucideReact.CheckCircle2;
|
|
15772
|
+
case "in_progress":
|
|
15773
|
+
return lucideReact.Loader2;
|
|
15774
|
+
case "blocked":
|
|
15775
|
+
return lucideReact.Lock;
|
|
15776
|
+
default:
|
|
15777
|
+
return lucideReact.Circle;
|
|
15778
|
+
}
|
|
15779
|
+
}
|
|
15780
|
+
function getStatusLabel3(status) {
|
|
15781
|
+
switch (status) {
|
|
15782
|
+
case "todo":
|
|
15783
|
+
return "To Do";
|
|
15784
|
+
case "in_progress":
|
|
15785
|
+
return "In Progress";
|
|
15786
|
+
case "done":
|
|
15787
|
+
return "Done";
|
|
15788
|
+
case "blocked":
|
|
15789
|
+
return "Blocked";
|
|
15790
|
+
default:
|
|
15791
|
+
return status;
|
|
15792
|
+
}
|
|
15793
|
+
}
|
|
15794
|
+
function getActionLabel(status, type) {
|
|
15795
|
+
if (status === "in_progress") {
|
|
15796
|
+
return "Mark Complete";
|
|
15797
|
+
}
|
|
15798
|
+
switch (type) {
|
|
15799
|
+
case "calculation":
|
|
15800
|
+
return "Start Calculation";
|
|
15801
|
+
case "review":
|
|
15802
|
+
return "Start Review";
|
|
15803
|
+
case "upload":
|
|
15804
|
+
return "Upload";
|
|
15805
|
+
case "approval":
|
|
15806
|
+
return "Request Approval";
|
|
15807
|
+
case "documentation":
|
|
15808
|
+
return "Start Documentation";
|
|
15809
|
+
default:
|
|
15810
|
+
return "Start";
|
|
15811
|
+
}
|
|
15812
|
+
}
|
|
15813
|
+
function SubtaskItem({
|
|
15814
|
+
subtaskState,
|
|
15815
|
+
onAction,
|
|
15816
|
+
compact = false,
|
|
15817
|
+
className
|
|
15818
|
+
}) {
|
|
15819
|
+
const { subtask, isLocked, lockReason, isNextAction, isActionable } = subtaskState;
|
|
15820
|
+
const TypeIcon = getSubtaskTypeIcon(subtask.type);
|
|
15821
|
+
const StatusIcon = getStatusIcon(subtask.status);
|
|
15822
|
+
const handleAction = React36__namespace.useCallback(() => {
|
|
15823
|
+
if (isActionable && onAction) {
|
|
15824
|
+
onAction(subtask);
|
|
15825
|
+
}
|
|
15826
|
+
}, [isActionable, onAction, subtask]);
|
|
15827
|
+
if (compact) {
|
|
15828
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
15829
|
+
"div",
|
|
15830
|
+
{
|
|
15831
|
+
className: cn(
|
|
15832
|
+
"flex items-center gap-2 py-1.5 px-2 rounded-md text-sm",
|
|
15833
|
+
isLocked && "opacity-60",
|
|
15834
|
+
subtask.status === "done" && "opacity-60",
|
|
15835
|
+
className
|
|
15836
|
+
),
|
|
15837
|
+
children: [
|
|
15838
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
15839
|
+
StatusIcon,
|
|
15840
|
+
{
|
|
15841
|
+
className: cn(
|
|
15842
|
+
"h-4 w-4 shrink-0",
|
|
15843
|
+
subtask.status === "done" && "text-green-600 dark:text-green-400",
|
|
15844
|
+
subtask.status === "in_progress" && "text-primary animate-spin",
|
|
15845
|
+
isLocked && "text-muted-foreground"
|
|
15846
|
+
)
|
|
15847
|
+
}
|
|
15848
|
+
),
|
|
15849
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(
|
|
15850
|
+
"truncate flex-1",
|
|
15851
|
+
subtask.status === "done" && "line-through text-muted-foreground"
|
|
15852
|
+
), children: subtask.title }),
|
|
15853
|
+
isLocked && /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(Tooltip2, { children: [
|
|
15854
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Lock, { className: "h-3 w-3 text-muted-foreground shrink-0" }) }),
|
|
15855
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { side: "left", className: "max-w-xs", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs", children: lockReason }) })
|
|
15856
|
+
] }) })
|
|
15857
|
+
]
|
|
15858
|
+
}
|
|
15859
|
+
);
|
|
15860
|
+
}
|
|
15861
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
15862
|
+
"div",
|
|
15863
|
+
{
|
|
15864
|
+
className: cn(
|
|
15865
|
+
"flex items-start gap-3 py-3 px-3 rounded-lg border bg-card transition-colors",
|
|
15866
|
+
isNextAction && "ring-2 ring-primary/20 border-primary/30",
|
|
15867
|
+
isLocked && "opacity-70 bg-muted/30",
|
|
15868
|
+
subtask.status === "done" && "bg-muted/20",
|
|
15869
|
+
className
|
|
15870
|
+
),
|
|
15871
|
+
children: [
|
|
15872
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pt-0.5", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
15873
|
+
StatusIcon,
|
|
15874
|
+
{
|
|
15875
|
+
className: cn(
|
|
15876
|
+
"h-5 w-5",
|
|
15877
|
+
subtask.status === "done" && "text-green-600 dark:text-green-400",
|
|
15878
|
+
subtask.status === "in_progress" && "text-primary animate-spin",
|
|
15879
|
+
subtask.status === "blocked" && "text-destructive",
|
|
15880
|
+
subtask.status === "todo" && !isLocked && "text-muted-foreground",
|
|
15881
|
+
isLocked && "text-muted-foreground"
|
|
15882
|
+
)
|
|
15883
|
+
}
|
|
15884
|
+
) }),
|
|
15885
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 min-w-0 space-y-1.5", children: [
|
|
15886
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between gap-2", children: [
|
|
15887
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2 min-w-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
15888
|
+
"span",
|
|
15889
|
+
{
|
|
15890
|
+
className: cn(
|
|
15891
|
+
"font-medium text-sm",
|
|
15892
|
+
subtask.status === "done" && "line-through text-muted-foreground"
|
|
15893
|
+
),
|
|
15894
|
+
children: subtask.title
|
|
15895
|
+
}
|
|
15896
|
+
) }),
|
|
15897
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
15898
|
+
Badge,
|
|
15899
|
+
{
|
|
15900
|
+
variant: "secondary",
|
|
15901
|
+
className: "shrink-0 text-[10px] px-1.5 py-0 gap-1",
|
|
15902
|
+
children: [
|
|
15903
|
+
/* @__PURE__ */ jsxRuntime.jsx(TypeIcon, { className: "h-3 w-3" }),
|
|
15904
|
+
getSubtaskTypeLabel(subtask.type)
|
|
15905
|
+
]
|
|
15906
|
+
}
|
|
15907
|
+
)
|
|
15908
|
+
] }),
|
|
15909
|
+
subtask.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground line-clamp-2", children: subtask.description }),
|
|
15910
|
+
isLocked && lockReason && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5 text-xs text-muted-foreground", children: [
|
|
15911
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Lock, { className: "h-3 w-3" }),
|
|
15912
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: lockReason })
|
|
15913
|
+
] }),
|
|
15914
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2 pt-1", children: [
|
|
15915
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 text-xs text-muted-foreground", children: [
|
|
15916
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
15917
|
+
Badge,
|
|
15918
|
+
{
|
|
15919
|
+
variant: "outline",
|
|
15920
|
+
className: cn(
|
|
15921
|
+
"text-[10px] px-1.5 py-0",
|
|
15922
|
+
subtask.status === "done" && "bg-green-500/10 text-green-600 dark:text-green-400 border-green-500/20",
|
|
15923
|
+
subtask.status === "in_progress" && "bg-primary/10 text-primary border-primary/20",
|
|
15924
|
+
subtask.status === "blocked" && "bg-destructive/10 text-destructive border-destructive/20"
|
|
15925
|
+
),
|
|
15926
|
+
children: getStatusLabel3(subtask.status)
|
|
15927
|
+
}
|
|
15928
|
+
),
|
|
15929
|
+
subtask.estimatedMinutes && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
15930
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Clock, { className: "h-3 w-3" }),
|
|
15931
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
15932
|
+
subtask.estimatedMinutes,
|
|
15933
|
+
"m"
|
|
15934
|
+
] })
|
|
15935
|
+
] }),
|
|
15936
|
+
subtask.assignee && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate max-w-[100px]", children: subtask.assignee.name })
|
|
15937
|
+
] }),
|
|
15938
|
+
isActionable && onAction && /* @__PURE__ */ jsxRuntime.jsx(
|
|
15939
|
+
Button,
|
|
15940
|
+
{
|
|
15941
|
+
size: "sm",
|
|
15942
|
+
variant: isNextAction ? "default" : "outline",
|
|
15943
|
+
className: "h-7 text-xs px-2",
|
|
15944
|
+
onClick: handleAction,
|
|
15945
|
+
children: getActionLabel(subtask.status, subtask.type)
|
|
15946
|
+
}
|
|
15947
|
+
)
|
|
15948
|
+
] })
|
|
15949
|
+
] })
|
|
15950
|
+
]
|
|
15951
|
+
}
|
|
15952
|
+
);
|
|
15953
|
+
}
|
|
15954
|
+
function getPriorityConfig(priority) {
|
|
15955
|
+
switch (priority) {
|
|
15956
|
+
case "urgent":
|
|
15957
|
+
return {
|
|
15958
|
+
label: "Urgent",
|
|
15959
|
+
className: "bg-red-500/15 text-red-700 dark:bg-red-500/20 dark:text-red-400"
|
|
15960
|
+
};
|
|
15961
|
+
case "high":
|
|
15962
|
+
return {
|
|
15963
|
+
label: "High",
|
|
15964
|
+
className: "bg-orange-500/15 text-orange-700 dark:bg-orange-500/20 dark:text-orange-400"
|
|
15965
|
+
};
|
|
15966
|
+
case "medium":
|
|
15967
|
+
return {
|
|
15968
|
+
label: "Medium",
|
|
15969
|
+
className: "bg-amber-500/15 text-amber-700 dark:bg-amber-500/20 dark:text-amber-400"
|
|
15970
|
+
};
|
|
15971
|
+
case "low":
|
|
15972
|
+
return {
|
|
15973
|
+
label: "Low",
|
|
15974
|
+
className: "bg-blue-500/15 text-blue-700 dark:bg-blue-500/20 dark:text-blue-400"
|
|
15975
|
+
};
|
|
15976
|
+
default:
|
|
15977
|
+
return { label: priority, className: "" };
|
|
15978
|
+
}
|
|
15979
|
+
}
|
|
15980
|
+
function getStatusConfig(status) {
|
|
15981
|
+
switch (status) {
|
|
15982
|
+
case "done":
|
|
15983
|
+
return {
|
|
15984
|
+
label: "Done",
|
|
15985
|
+
className: "bg-green-500/15 text-green-700 dark:bg-green-500/20 dark:text-green-400"
|
|
15986
|
+
};
|
|
15987
|
+
case "in_progress":
|
|
15988
|
+
return {
|
|
15989
|
+
label: "In Progress",
|
|
15990
|
+
className: "bg-primary/15 text-primary"
|
|
15991
|
+
};
|
|
15992
|
+
case "waiting":
|
|
15993
|
+
return {
|
|
15994
|
+
label: "Waiting",
|
|
15995
|
+
className: "bg-amber-500/15 text-amber-700 dark:bg-amber-500/20 dark:text-amber-400"
|
|
15996
|
+
};
|
|
15997
|
+
case "ready":
|
|
15998
|
+
return {
|
|
15999
|
+
label: "Ready",
|
|
16000
|
+
className: "bg-green-500/15 text-green-700 dark:bg-green-500/20 dark:text-green-400"
|
|
16001
|
+
};
|
|
16002
|
+
case "not_started":
|
|
16003
|
+
return {
|
|
16004
|
+
label: "Not Started",
|
|
16005
|
+
className: "bg-muted text-muted-foreground"
|
|
16006
|
+
};
|
|
16007
|
+
default:
|
|
16008
|
+
return { label: status, className: "" };
|
|
16009
|
+
}
|
|
16010
|
+
}
|
|
16011
|
+
function formatDate3(date) {
|
|
16012
|
+
return new Intl.DateTimeFormat("en-US", {
|
|
16013
|
+
month: "short",
|
|
16014
|
+
day: "numeric"
|
|
16015
|
+
}).format(date);
|
|
16016
|
+
}
|
|
16017
|
+
function PackageCard({
|
|
16018
|
+
packageState,
|
|
16019
|
+
onSubtaskAction,
|
|
16020
|
+
onPackageClick,
|
|
16021
|
+
className
|
|
16022
|
+
}) {
|
|
16023
|
+
const [isExpanded, setIsExpanded] = React36__namespace.useState(false);
|
|
16024
|
+
const {
|
|
16025
|
+
package: pkg,
|
|
16026
|
+
status,
|
|
16027
|
+
progress,
|
|
16028
|
+
completedCount,
|
|
16029
|
+
totalCount,
|
|
16030
|
+
nextAction,
|
|
16031
|
+
nextActionLabel,
|
|
16032
|
+
subtaskStates,
|
|
16033
|
+
isComplete,
|
|
16034
|
+
isWaiting
|
|
16035
|
+
} = packageState;
|
|
16036
|
+
const priorityConfig = getPriorityConfig(pkg.priority);
|
|
16037
|
+
const statusConfig = getStatusConfig(status);
|
|
16038
|
+
const handleCardClick = React36__namespace.useCallback((e) => {
|
|
16039
|
+
if (e.target.closest('button, [role="button"]')) {
|
|
16040
|
+
return;
|
|
16041
|
+
}
|
|
16042
|
+
onPackageClick?.(pkg);
|
|
16043
|
+
}, [onPackageClick, pkg]);
|
|
16044
|
+
const handleNextAction = React36__namespace.useCallback(() => {
|
|
16045
|
+
if (nextAction && onSubtaskAction) {
|
|
16046
|
+
onSubtaskAction(nextAction.subtask);
|
|
16047
|
+
}
|
|
16048
|
+
}, [nextAction, onSubtaskAction]);
|
|
16049
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
16050
|
+
Card,
|
|
16051
|
+
{
|
|
16052
|
+
className: cn(
|
|
16053
|
+
"p-3 space-y-3 cursor-pointer transition-all hover:shadow-md",
|
|
16054
|
+
isComplete && "opacity-80",
|
|
16055
|
+
className
|
|
16056
|
+
),
|
|
16057
|
+
onClick: handleCardClick,
|
|
16058
|
+
children: [
|
|
16059
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between gap-2", children: [
|
|
16060
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2 min-w-0 flex-1", children: [
|
|
16061
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Package, { className: "h-4 w-4 mt-0.5 shrink-0 text-muted-foreground" }),
|
|
16062
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0", children: [
|
|
16063
|
+
/* @__PURE__ */ jsxRuntime.jsx("h4", { className: "font-medium text-sm leading-tight truncate", children: pkg.name }),
|
|
16064
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground truncate", children: pkg.project })
|
|
16065
|
+
] })
|
|
16066
|
+
] }),
|
|
16067
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
16068
|
+
Badge,
|
|
16069
|
+
{
|
|
16070
|
+
variant: "secondary",
|
|
16071
|
+
className: cn("text-[10px] px-1.5 py-0 shrink-0", priorityConfig.className),
|
|
16072
|
+
children: priorityConfig.label
|
|
16073
|
+
}
|
|
16074
|
+
)
|
|
16075
|
+
] }),
|
|
16076
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
|
|
16077
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between text-xs", children: [
|
|
16078
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Progress" }),
|
|
16079
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-medium", children: [
|
|
16080
|
+
completedCount,
|
|
16081
|
+
"/",
|
|
16082
|
+
totalCount
|
|
16083
|
+
] })
|
|
16084
|
+
] }),
|
|
16085
|
+
/* @__PURE__ */ jsxRuntime.jsx(Progress, { value: progress * 100, className: "h-1.5" })
|
|
16086
|
+
] }),
|
|
16087
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
16088
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
16089
|
+
Badge,
|
|
16090
|
+
{
|
|
16091
|
+
variant: "secondary",
|
|
16092
|
+
className: cn("text-[10px] px-1.5 py-0", statusConfig.className),
|
|
16093
|
+
children: statusConfig.label
|
|
16094
|
+
}
|
|
16095
|
+
),
|
|
16096
|
+
isWaiting ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 text-xs text-muted-foreground", children: [
|
|
16097
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Clock, { className: "h-3 w-3" }),
|
|
16098
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Waiting" })
|
|
16099
|
+
] }) : nextAction ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
16100
|
+
Button,
|
|
16101
|
+
{
|
|
16102
|
+
size: "sm",
|
|
16103
|
+
variant: "default",
|
|
16104
|
+
className: "h-6 text-[10px] px-2",
|
|
16105
|
+
onClick: (e) => {
|
|
16106
|
+
e.stopPropagation();
|
|
16107
|
+
handleNextAction();
|
|
16108
|
+
},
|
|
16109
|
+
children: nextActionLabel
|
|
16110
|
+
}
|
|
16111
|
+
) : isComplete ? /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "outline", className: "text-[10px] px-1.5 py-0 bg-green-500/10 text-green-600 border-green-500/20", children: "Complete" }) : null
|
|
16112
|
+
] }),
|
|
16113
|
+
(pkg.dueDate || pkg.tags && pkg.tags.length > 0) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2 pt-1 border-t border-border/50", children: [
|
|
16114
|
+
pkg.dueDate && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 text-xs text-muted-foreground", children: [
|
|
16115
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.CalendarDays, { className: "h-3 w-3" }),
|
|
16116
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: formatDate3(pkg.dueDate) })
|
|
16117
|
+
] }),
|
|
16118
|
+
pkg.tags && pkg.tags.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 flex-wrap justify-end", children: [
|
|
16119
|
+
pkg.tags.slice(0, 2).map((tag) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
16120
|
+
Badge,
|
|
16121
|
+
{
|
|
16122
|
+
variant: "outline",
|
|
16123
|
+
className: "text-[9px] px-1 py-0 h-4",
|
|
16124
|
+
children: tag
|
|
16125
|
+
},
|
|
16126
|
+
tag
|
|
16127
|
+
)),
|
|
16128
|
+
pkg.tags.length > 2 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-[9px] text-muted-foreground", children: [
|
|
16129
|
+
"+",
|
|
16130
|
+
pkg.tags.length - 2
|
|
16131
|
+
] })
|
|
16132
|
+
] })
|
|
16133
|
+
] }),
|
|
16134
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Collapsible, { open: isExpanded, onOpenChange: setIsExpanded, children: [
|
|
16135
|
+
/* @__PURE__ */ jsxRuntime.jsx(CollapsibleTrigger2, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
16136
|
+
Button,
|
|
16137
|
+
{
|
|
16138
|
+
variant: "ghost",
|
|
16139
|
+
size: "sm",
|
|
16140
|
+
className: "w-full h-7 text-xs text-muted-foreground hover:text-foreground justify-between",
|
|
16141
|
+
onClick: (e) => e.stopPropagation(),
|
|
16142
|
+
children: [
|
|
16143
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1", children: [
|
|
16144
|
+
isExpanded ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "h-3 w-3" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "h-3 w-3" }),
|
|
16145
|
+
subtaskStates.length,
|
|
16146
|
+
" subtasks"
|
|
16147
|
+
] }),
|
|
16148
|
+
subtaskStates.some((s) => s.isLocked) && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1 text-amber-600 dark:text-amber-400", children: [
|
|
16149
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertCircle, { className: "h-3 w-3" }),
|
|
16150
|
+
subtaskStates.filter((s) => s.isLocked).length,
|
|
16151
|
+
" locked"
|
|
16152
|
+
] })
|
|
16153
|
+
]
|
|
16154
|
+
}
|
|
16155
|
+
) }),
|
|
16156
|
+
/* @__PURE__ */ jsxRuntime.jsx(CollapsibleContent2, { className: "pt-2 space-y-1.5", children: subtaskStates.map((subtaskState) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
16157
|
+
SubtaskItem,
|
|
16158
|
+
{
|
|
16159
|
+
subtaskState,
|
|
16160
|
+
onAction: onSubtaskAction,
|
|
16161
|
+
compact: true
|
|
16162
|
+
},
|
|
16163
|
+
subtaskState.subtask.id
|
|
16164
|
+
)) })
|
|
16165
|
+
] }),
|
|
16166
|
+
isWaiting && !isComplete && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
16167
|
+
Button,
|
|
16168
|
+
{
|
|
16169
|
+
variant: "ghost",
|
|
16170
|
+
size: "sm",
|
|
16171
|
+
className: "w-full h-7 text-xs text-muted-foreground",
|
|
16172
|
+
onClick: (e) => {
|
|
16173
|
+
e.stopPropagation();
|
|
16174
|
+
onPackageClick?.(pkg);
|
|
16175
|
+
},
|
|
16176
|
+
children: [
|
|
16177
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ExternalLink, { className: "h-3 w-3 mr-1" }),
|
|
16178
|
+
"View context"
|
|
16179
|
+
]
|
|
16180
|
+
}
|
|
16181
|
+
)
|
|
16182
|
+
]
|
|
16183
|
+
}
|
|
16184
|
+
);
|
|
16185
|
+
}
|
|
16186
|
+
|
|
16187
|
+
// src/blocks/todo-board/rules.ts
|
|
16188
|
+
function areDependenciesSatisfied(subtask, allSubtasks) {
|
|
16189
|
+
if (subtask.dependsOn.length === 0) return true;
|
|
16190
|
+
return subtask.dependsOn.every((depId) => {
|
|
16191
|
+
const dep = allSubtasks.find((s) => s.id === depId);
|
|
16192
|
+
return dep?.status === "done";
|
|
16193
|
+
});
|
|
16194
|
+
}
|
|
16195
|
+
function getBlockingSubtasks(subtask, allSubtasks) {
|
|
16196
|
+
return subtask.dependsOn.map((depId) => allSubtasks.find((s) => s.id === depId)).filter((dep) => dep !== void 0 && dep.status !== "done");
|
|
16197
|
+
}
|
|
16198
|
+
function generateLockReason(blockingSubtasks) {
|
|
16199
|
+
if (blockingSubtasks.length === 0) return "";
|
|
16200
|
+
if (blockingSubtasks.length === 1) {
|
|
16201
|
+
return `Waiting for "${blockingSubtasks[0].title}" to complete`;
|
|
16202
|
+
}
|
|
16203
|
+
const typeGroups = blockingSubtasks.reduce((acc, subtask) => {
|
|
16204
|
+
acc[subtask.type] = (acc[subtask.type] || 0) + 1;
|
|
16205
|
+
return acc;
|
|
16206
|
+
}, {});
|
|
16207
|
+
const parts = Object.entries(typeGroups).map(
|
|
16208
|
+
([type, count]) => count === 1 ? `1 ${type}` : `${count} ${type}s`
|
|
16209
|
+
);
|
|
16210
|
+
return `Waiting for ${parts.join(", ")} to complete`;
|
|
16211
|
+
}
|
|
16212
|
+
function computeSubtaskState(subtask, allSubtasks, isNextAction) {
|
|
16213
|
+
const blockingSubtasks = getBlockingSubtasks(subtask, allSubtasks);
|
|
16214
|
+
const isLocked = blockingSubtasks.length > 0;
|
|
16215
|
+
const lockReason = isLocked ? generateLockReason(blockingSubtasks) : void 0;
|
|
16216
|
+
const isActionable = !isLocked && subtask.status !== "done" && subtask.status !== "blocked";
|
|
16217
|
+
return {
|
|
16218
|
+
subtask,
|
|
16219
|
+
isLocked,
|
|
16220
|
+
lockReason,
|
|
16221
|
+
blockedBy: blockingSubtasks.map((s) => s.id),
|
|
16222
|
+
isNextAction,
|
|
16223
|
+
isActionable
|
|
16224
|
+
};
|
|
16225
|
+
}
|
|
16226
|
+
function allRequiredSubtasksDone(pkg, config) {
|
|
16227
|
+
if (!config?.requirements) {
|
|
16228
|
+
return pkg.subtasks.every((s) => s.status === "done");
|
|
16229
|
+
}
|
|
16230
|
+
for (const req of config.requirements) {
|
|
16231
|
+
const subtasksOfType = pkg.subtasks.filter((s) => s.type === req.type);
|
|
16232
|
+
const doneCount = subtasksOfType.filter((s) => s.status === "done").length;
|
|
16233
|
+
if (doneCount < req.minCount) return false;
|
|
16234
|
+
}
|
|
16235
|
+
return pkg.subtasks.every((s) => s.status === "done");
|
|
16236
|
+
}
|
|
16237
|
+
function anySubtaskStartedOrDone(pkg) {
|
|
16238
|
+
return pkg.subtasks.some(
|
|
16239
|
+
(s) => s.status === "in_progress" || s.status === "done"
|
|
16240
|
+
);
|
|
16241
|
+
}
|
|
16242
|
+
function derivePackageBucket(pkg, config) {
|
|
16243
|
+
if (allRequiredSubtasksDone(pkg, config)) {
|
|
16244
|
+
return "completed";
|
|
16245
|
+
}
|
|
16246
|
+
if (anySubtaskStartedOrDone(pkg)) {
|
|
16247
|
+
return "in_progress";
|
|
16248
|
+
}
|
|
16249
|
+
return "next";
|
|
16250
|
+
}
|
|
16251
|
+
function derivePackageStatus(pkg, bucket, hasNextAction) {
|
|
16252
|
+
if (bucket === "completed") {
|
|
16253
|
+
return "done";
|
|
16254
|
+
}
|
|
16255
|
+
if (bucket === "next" && !anySubtaskStartedOrDone(pkg)) {
|
|
16256
|
+
return "not_started";
|
|
16257
|
+
}
|
|
16258
|
+
if (!hasNextAction) {
|
|
16259
|
+
return "waiting";
|
|
16260
|
+
}
|
|
16261
|
+
return "in_progress";
|
|
16262
|
+
}
|
|
16263
|
+
function findNextActionableSubtask(subtaskStates) {
|
|
16264
|
+
const sorted = [...subtaskStates].sort(
|
|
16265
|
+
(a, b) => a.subtask.order - b.subtask.order
|
|
16266
|
+
);
|
|
16267
|
+
const inProgress = sorted.find(
|
|
16268
|
+
(s) => s.isActionable && s.subtask.status === "in_progress"
|
|
16269
|
+
);
|
|
16270
|
+
if (inProgress) return inProgress;
|
|
16271
|
+
const todo = sorted.find(
|
|
16272
|
+
(s) => s.isActionable && s.subtask.status === "todo"
|
|
16273
|
+
);
|
|
16274
|
+
return todo;
|
|
16275
|
+
}
|
|
16276
|
+
function generateNextActionLabel(nextAction) {
|
|
16277
|
+
if (!nextAction) return void 0;
|
|
16278
|
+
const { subtask } = nextAction;
|
|
16279
|
+
if (subtask.status === "in_progress") {
|
|
16280
|
+
switch (subtask.type) {
|
|
16281
|
+
case "calculation":
|
|
16282
|
+
return "Continue Calculation";
|
|
16283
|
+
case "review":
|
|
16284
|
+
return "Continue Review";
|
|
16285
|
+
case "upload":
|
|
16286
|
+
return "Resume Upload";
|
|
16287
|
+
case "approval":
|
|
16288
|
+
return "Continue Approval";
|
|
16289
|
+
case "documentation":
|
|
16290
|
+
return "Continue Documentation";
|
|
16291
|
+
default:
|
|
16292
|
+
return "Continue Task";
|
|
16293
|
+
}
|
|
16294
|
+
}
|
|
16295
|
+
switch (subtask.type) {
|
|
16296
|
+
case "calculation":
|
|
16297
|
+
return "Start Calculation";
|
|
16298
|
+
case "review":
|
|
16299
|
+
return "Start Review";
|
|
16300
|
+
case "upload":
|
|
16301
|
+
return "Upload Files";
|
|
16302
|
+
case "approval":
|
|
16303
|
+
return "Request Approval";
|
|
16304
|
+
case "documentation":
|
|
16305
|
+
return "Add Documentation";
|
|
16306
|
+
default:
|
|
16307
|
+
return "Start Task";
|
|
16308
|
+
}
|
|
16309
|
+
}
|
|
16310
|
+
function calculateProgress(pkg) {
|
|
16311
|
+
const totalCount = pkg.subtasks.length;
|
|
16312
|
+
if (totalCount === 0) {
|
|
16313
|
+
return { progress: 1, completedCount: 0, totalCount: 0 };
|
|
16314
|
+
}
|
|
16315
|
+
const completedCount = pkg.subtasks.filter((s) => s.status === "done").length;
|
|
16316
|
+
const progress = completedCount / totalCount;
|
|
16317
|
+
return { progress, completedCount, totalCount };
|
|
16318
|
+
}
|
|
16319
|
+
function computePackageDerivedState(pkg, config) {
|
|
16320
|
+
const subtaskStatesWithoutNextAction = pkg.subtasks.map(
|
|
16321
|
+
(subtask) => computeSubtaskState(subtask, pkg.subtasks, false)
|
|
16322
|
+
);
|
|
16323
|
+
const nextActionCandidate = findNextActionableSubtask(subtaskStatesWithoutNextAction);
|
|
16324
|
+
const subtaskStates = subtaskStatesWithoutNextAction.map((state) => ({
|
|
16325
|
+
...state,
|
|
16326
|
+
isNextAction: state.subtask.id === nextActionCandidate?.subtask.id
|
|
16327
|
+
}));
|
|
16328
|
+
const nextAction = nextActionCandidate ? subtaskStates.find((s) => s.isNextAction) : void 0;
|
|
16329
|
+
const bucket = derivePackageBucket(pkg, config);
|
|
16330
|
+
const hasNextAction = nextAction !== void 0;
|
|
16331
|
+
const status = derivePackageStatus(pkg, bucket, hasNextAction);
|
|
16332
|
+
const { progress, completedCount, totalCount } = calculateProgress(pkg);
|
|
16333
|
+
const nextActionLabel = generateNextActionLabel(nextAction);
|
|
16334
|
+
return {
|
|
16335
|
+
package: pkg,
|
|
16336
|
+
bucket,
|
|
16337
|
+
status,
|
|
16338
|
+
progress,
|
|
16339
|
+
completedCount,
|
|
16340
|
+
totalCount,
|
|
16341
|
+
nextAction,
|
|
16342
|
+
nextActionLabel,
|
|
16343
|
+
subtaskStates,
|
|
16344
|
+
isComplete: bucket === "completed",
|
|
16345
|
+
isWaiting: status === "waiting"
|
|
16346
|
+
};
|
|
16347
|
+
}
|
|
16348
|
+
function computeAllPackageStates(packages, config) {
|
|
16349
|
+
return packages.map((pkg) => computePackageDerivedState(pkg, config));
|
|
16350
|
+
}
|
|
16351
|
+
function groupPackagesByBucket(packageStates) {
|
|
16352
|
+
return {
|
|
16353
|
+
next: packageStates.filter((p) => p.bucket === "next"),
|
|
16354
|
+
in_progress: packageStates.filter((p) => p.bucket === "in_progress"),
|
|
16355
|
+
completed: packageStates.filter((p) => p.bucket === "completed")
|
|
16356
|
+
};
|
|
16357
|
+
}
|
|
16358
|
+
function updateSubtaskStatus(pkg, subtaskId, newStatus, config) {
|
|
16359
|
+
const updatedSubtasks = pkg.subtasks.map((subtask) => {
|
|
16360
|
+
if (subtask.id !== subtaskId) return subtask;
|
|
16361
|
+
return {
|
|
16362
|
+
...subtask,
|
|
16363
|
+
status: newStatus,
|
|
16364
|
+
completedAt: newStatus === "done" ? /* @__PURE__ */ new Date() : void 0
|
|
16365
|
+
};
|
|
16366
|
+
});
|
|
16367
|
+
const updatedPackage = {
|
|
16368
|
+
...pkg,
|
|
16369
|
+
subtasks: updatedSubtasks,
|
|
16370
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
16371
|
+
};
|
|
16372
|
+
const derivedState = computePackageDerivedState(updatedPackage, config);
|
|
16373
|
+
return { updatedPackage, derivedState };
|
|
16374
|
+
}
|
|
16375
|
+
function startSubtask(pkg, subtaskId, config) {
|
|
16376
|
+
return updateSubtaskStatus(pkg, subtaskId, "in_progress", config);
|
|
16377
|
+
}
|
|
16378
|
+
function completeSubtask(pkg, subtaskId, config) {
|
|
16379
|
+
return updateSubtaskStatus(pkg, subtaskId, "done", config);
|
|
16380
|
+
}
|
|
16381
|
+
var DEFAULT_BUCKETS = [
|
|
16382
|
+
{ id: "next", name: "Next" },
|
|
16383
|
+
{ id: "in_progress", name: "In Progress" },
|
|
16384
|
+
{ id: "completed", name: "Completed" }
|
|
16385
|
+
];
|
|
16386
|
+
function getBucketConfig(config) {
|
|
16387
|
+
return config?.buckets ?? DEFAULT_BUCKETS;
|
|
16388
|
+
}
|
|
16389
|
+
function SortablePackageCard({
|
|
16390
|
+
packageState,
|
|
16391
|
+
onSubtaskAction,
|
|
16392
|
+
onPackageClick
|
|
16393
|
+
}) {
|
|
16394
|
+
const {
|
|
16395
|
+
attributes,
|
|
16396
|
+
listeners,
|
|
16397
|
+
setNodeRef,
|
|
16398
|
+
transform,
|
|
16399
|
+
transition,
|
|
16400
|
+
isDragging
|
|
16401
|
+
} = sortable.useSortable({
|
|
16402
|
+
id: packageState.package.id,
|
|
16403
|
+
data: {
|
|
16404
|
+
type: "package",
|
|
16405
|
+
packageState
|
|
16406
|
+
}
|
|
16407
|
+
});
|
|
16408
|
+
const style = {
|
|
16409
|
+
transform: utilities.CSS.Transform.toString(transform),
|
|
16410
|
+
transition
|
|
16411
|
+
};
|
|
16412
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
16413
|
+
"div",
|
|
16414
|
+
{
|
|
16415
|
+
ref: setNodeRef,
|
|
16416
|
+
style,
|
|
16417
|
+
...attributes,
|
|
16418
|
+
...listeners,
|
|
16419
|
+
className: cn(
|
|
16420
|
+
"cursor-grab active:cursor-grabbing",
|
|
16421
|
+
isDragging && "opacity-30"
|
|
16422
|
+
),
|
|
16423
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
16424
|
+
PackageCard,
|
|
16425
|
+
{
|
|
16426
|
+
packageState,
|
|
16427
|
+
onSubtaskAction,
|
|
16428
|
+
onPackageClick
|
|
16429
|
+
}
|
|
16430
|
+
)
|
|
16431
|
+
}
|
|
16432
|
+
);
|
|
16433
|
+
}
|
|
16434
|
+
function KanbanColumn({
|
|
16435
|
+
id,
|
|
16436
|
+
name,
|
|
16437
|
+
packageStates,
|
|
16438
|
+
onSubtaskAction,
|
|
16439
|
+
onPackageClick
|
|
16440
|
+
}) {
|
|
16441
|
+
const packageIds = packageStates.map((p) => p.package.id);
|
|
16442
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col min-w-[280px] max-w-[320px] flex-1 h-full bg-muted/20 rounded-lg border", children: [
|
|
16443
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between p-3 border-b bg-muted/30 shrink-0", children: [
|
|
16444
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold text-sm", children: name }),
|
|
16445
|
+
/* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "secondary", className: "text-xs", children: packageStates.length })
|
|
16446
|
+
] }),
|
|
16447
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ScrollArea, { className: "flex-1 min-h-0", children: [
|
|
16448
|
+
/* @__PURE__ */ jsxRuntime.jsx(sortable.SortableContext, { items: packageIds, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-2 space-y-2", children: [
|
|
16449
|
+
packageStates.map((packageState) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
16450
|
+
SortablePackageCard,
|
|
16451
|
+
{
|
|
16452
|
+
packageState,
|
|
16453
|
+
onSubtaskAction,
|
|
16454
|
+
onPackageClick
|
|
16455
|
+
},
|
|
16456
|
+
packageState.package.id
|
|
16457
|
+
)),
|
|
16458
|
+
packageStates.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center h-[100px] text-sm text-muted-foreground", children: "No packages" })
|
|
16459
|
+
] }) }),
|
|
16460
|
+
/* @__PURE__ */ jsxRuntime.jsx(ScrollBar, { orientation: "vertical" })
|
|
16461
|
+
] })
|
|
16462
|
+
] });
|
|
16463
|
+
}
|
|
16464
|
+
function TodoBoard({
|
|
16465
|
+
packages,
|
|
16466
|
+
workflowConfig,
|
|
16467
|
+
onSubtaskAction,
|
|
16468
|
+
onPackageClick,
|
|
16469
|
+
onPackagesChange,
|
|
16470
|
+
height = 600,
|
|
16471
|
+
className
|
|
16472
|
+
}) {
|
|
16473
|
+
const [activeId, setActiveId] = React36__namespace.useState(null);
|
|
16474
|
+
const sensors = core.useSensors(
|
|
16475
|
+
core.useSensor(core.MouseSensor, {
|
|
16476
|
+
activationConstraint: { distance: 8 }
|
|
16477
|
+
}),
|
|
16478
|
+
core.useSensor(core.TouchSensor, {
|
|
16479
|
+
activationConstraint: { delay: 200, tolerance: 5 }
|
|
16480
|
+
})
|
|
16481
|
+
);
|
|
16482
|
+
const packageStates = React36__namespace.useMemo(
|
|
16483
|
+
() => computeAllPackageStates(packages, workflowConfig),
|
|
16484
|
+
[packages, workflowConfig]
|
|
16485
|
+
);
|
|
16486
|
+
const groupedPackages = React36__namespace.useMemo(
|
|
16487
|
+
() => groupPackagesByBucket(packageStates),
|
|
16488
|
+
[packageStates]
|
|
16489
|
+
);
|
|
16490
|
+
const buckets = getBucketConfig(workflowConfig);
|
|
16491
|
+
const activePackageState = React36__namespace.useMemo(
|
|
16492
|
+
() => packageStates.find((p) => p.package.id === activeId),
|
|
16493
|
+
[packageStates, activeId]
|
|
16494
|
+
);
|
|
16495
|
+
const handleDragStart = React36__namespace.useCallback((event) => {
|
|
16496
|
+
setActiveId(event.active.id);
|
|
16497
|
+
}, []);
|
|
16498
|
+
const handleDragEnd = React36__namespace.useCallback((event) => {
|
|
16499
|
+
setActiveId(null);
|
|
16500
|
+
}, []);
|
|
16501
|
+
const heightStyle = typeof height === "number" ? `${height}px` : height;
|
|
16502
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("space-y-4", className), children: [
|
|
16503
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsxRuntime.jsxs(Badge, { variant: "outline", className: "text-sm", children: [
|
|
16504
|
+
packages.length,
|
|
16505
|
+
" packages"
|
|
16506
|
+
] }) }),
|
|
16507
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
16508
|
+
core.DndContext,
|
|
16509
|
+
{
|
|
16510
|
+
sensors,
|
|
16511
|
+
collisionDetection: core.closestCenter,
|
|
16512
|
+
onDragStart: handleDragStart,
|
|
16513
|
+
onDragEnd: handleDragEnd,
|
|
16514
|
+
children: [
|
|
16515
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
16516
|
+
"div",
|
|
16517
|
+
{
|
|
16518
|
+
className: "flex gap-4 overflow-x-auto pb-2",
|
|
16519
|
+
style: { height: heightStyle },
|
|
16520
|
+
children: buckets.map((bucket) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
16521
|
+
KanbanColumn,
|
|
16522
|
+
{
|
|
16523
|
+
id: bucket.id,
|
|
16524
|
+
name: bucket.name,
|
|
16525
|
+
packageStates: groupedPackages[bucket.id] || [],
|
|
16526
|
+
onSubtaskAction,
|
|
16527
|
+
onPackageClick
|
|
16528
|
+
},
|
|
16529
|
+
bucket.id
|
|
16530
|
+
))
|
|
16531
|
+
}
|
|
16532
|
+
),
|
|
16533
|
+
typeof window !== "undefined" && reactDom.createPortal(
|
|
16534
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.DragOverlay, { children: activePackageState && /* @__PURE__ */ jsxRuntime.jsx(
|
|
16535
|
+
PackageCard,
|
|
16536
|
+
{
|
|
16537
|
+
packageState: activePackageState,
|
|
16538
|
+
className: "rotate-3 shadow-xl ring-2 ring-primary"
|
|
16539
|
+
}
|
|
16540
|
+
) }),
|
|
16541
|
+
document.body
|
|
16542
|
+
)
|
|
16543
|
+
]
|
|
16544
|
+
}
|
|
16545
|
+
)
|
|
16546
|
+
] });
|
|
16547
|
+
}
|
|
16548
|
+
var DEFAULT_BUCKETS2 = [
|
|
16549
|
+
{ id: "in_progress", name: "In progress", color: "bg-orange-500" },
|
|
16550
|
+
{ id: "next", name: "To-do", color: "bg-cyan-500" },
|
|
16551
|
+
{ id: "completed", name: "Completed", color: "bg-green-500" }
|
|
16552
|
+
];
|
|
16553
|
+
var PRIORITY_ORDER = {
|
|
16554
|
+
urgent: 0,
|
|
16555
|
+
high: 1,
|
|
16556
|
+
medium: 2,
|
|
16557
|
+
low: 3
|
|
16558
|
+
};
|
|
16559
|
+
function getBucketConfig2(config) {
|
|
16560
|
+
if (!config?.buckets) return DEFAULT_BUCKETS2;
|
|
16561
|
+
return config.buckets.map((b) => {
|
|
16562
|
+
const defaultBucket = DEFAULT_BUCKETS2.find((d) => d.id === b.id);
|
|
16563
|
+
return {
|
|
16564
|
+
...b,
|
|
16565
|
+
color: defaultBucket?.color ?? "bg-muted"
|
|
16566
|
+
};
|
|
16567
|
+
});
|
|
16568
|
+
}
|
|
16569
|
+
function getPriorityBadge(priority) {
|
|
16570
|
+
const config = {
|
|
16571
|
+
urgent: { label: "Urgent", className: "bg-red-500/15 text-red-600 dark:text-red-400" },
|
|
16572
|
+
high: { label: "High", className: "bg-orange-500/15 text-orange-600 dark:text-orange-400" },
|
|
16573
|
+
medium: { label: "Normal", className: "bg-muted text-muted-foreground" },
|
|
16574
|
+
low: { label: "Low", className: "bg-blue-500/15 text-blue-600 dark:text-blue-400" }
|
|
16575
|
+
};
|
|
16576
|
+
return config[priority] ?? config.medium;
|
|
16577
|
+
}
|
|
16578
|
+
function getStatusBadge2(status, isLocked) {
|
|
16579
|
+
if (isLocked) {
|
|
16580
|
+
return { label: "Locked", className: "bg-muted text-muted-foreground" };
|
|
16581
|
+
}
|
|
16582
|
+
const config = {
|
|
16583
|
+
done: { label: "Completed", className: "bg-green-500/15 text-green-600 dark:text-green-400" },
|
|
16584
|
+
in_progress: { label: "Started", className: "bg-amber-500/15 text-amber-600 dark:text-amber-400" },
|
|
16585
|
+
todo: { label: "To do", className: "bg-muted text-muted-foreground" },
|
|
16586
|
+
blocked: { label: "Blocked", className: "bg-red-500/15 text-red-600 dark:text-red-400" }
|
|
16587
|
+
};
|
|
16588
|
+
return config[status] ?? config.todo;
|
|
16589
|
+
}
|
|
16590
|
+
function formatDate4(date) {
|
|
16591
|
+
const now = /* @__PURE__ */ new Date();
|
|
16592
|
+
const today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
|
|
16593
|
+
const dateOnly = new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
|
16594
|
+
if (dateOnly.getTime() === today.getTime()) {
|
|
16595
|
+
return `Today, ${date.toLocaleTimeString("en-US", { hour: "numeric", minute: "2-digit", hour12: true }).toLowerCase()}`;
|
|
16596
|
+
}
|
|
16597
|
+
const days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
16598
|
+
const dayName = days[date.getDay()];
|
|
16599
|
+
const time = date.toLocaleTimeString("en-US", { hour: "numeric", minute: "2-digit", hour12: true }).toLowerCase();
|
|
16600
|
+
return `${dayName}, ${time}`;
|
|
16601
|
+
}
|
|
16602
|
+
function sortPackages(packages, field, direction) {
|
|
16603
|
+
if (!direction) return packages;
|
|
16604
|
+
return [...packages].sort((a, b) => {
|
|
16605
|
+
let comparison = 0;
|
|
16606
|
+
switch (field) {
|
|
16607
|
+
case "status":
|
|
16608
|
+
comparison = a.progress - b.progress;
|
|
16609
|
+
break;
|
|
16610
|
+
case "dueDate":
|
|
16611
|
+
const dateA = a.package.dueDate?.getTime() ?? Infinity;
|
|
16612
|
+
const dateB = b.package.dueDate?.getTime() ?? Infinity;
|
|
16613
|
+
comparison = dateA - dateB;
|
|
16614
|
+
break;
|
|
16615
|
+
case "priority":
|
|
16616
|
+
comparison = PRIORITY_ORDER[a.package.priority] - PRIORITY_ORDER[b.package.priority];
|
|
16617
|
+
break;
|
|
16618
|
+
}
|
|
16619
|
+
return direction === "asc" ? comparison : -comparison;
|
|
16620
|
+
});
|
|
16621
|
+
}
|
|
16622
|
+
function SortableHeader({ label, field, currentSort, onSort }) {
|
|
16623
|
+
const isActive = currentSort.field === field && currentSort.direction !== null;
|
|
16624
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
16625
|
+
Button,
|
|
16626
|
+
{
|
|
16627
|
+
variant: "ghost",
|
|
16628
|
+
size: "sm",
|
|
16629
|
+
className: cn(
|
|
16630
|
+
"h-auto p-0 font-medium hover:bg-transparent",
|
|
16631
|
+
isActive && "text-foreground"
|
|
16632
|
+
),
|
|
16633
|
+
onClick: () => onSort(field),
|
|
16634
|
+
children: [
|
|
16635
|
+
label,
|
|
16636
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsUpDown, { className: "ml-1 h-3 w-3" })
|
|
16637
|
+
]
|
|
16638
|
+
}
|
|
16639
|
+
);
|
|
16640
|
+
}
|
|
16641
|
+
function BucketHeaderRow({ name, color, currentSort, onSort }) {
|
|
16642
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(TableRow, { className: "bg-background hover:bg-background border-t-2", children: [
|
|
16643
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableCell, { colSpan: 2, className: "py-3", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
16644
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-2.5 h-2.5 rounded-full", color) }),
|
|
16645
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold text-sm", children: name })
|
|
16646
|
+
] }) }),
|
|
16647
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableCell, { className: "py-3", children: /* @__PURE__ */ jsxRuntime.jsx(SortableHeader, { label: "Status", field: "status", currentSort, onSort }) }),
|
|
16648
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableCell, { className: "py-3", children: /* @__PURE__ */ jsxRuntime.jsx(SortableHeader, { label: "Due Date", field: "dueDate", currentSort, onSort }) }),
|
|
16649
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableCell, { className: "py-3", children: /* @__PURE__ */ jsxRuntime.jsx(SortableHeader, { label: "Priority", field: "priority", currentSort, onSort }) })
|
|
16650
|
+
] });
|
|
16651
|
+
}
|
|
16652
|
+
function PackageRow({ packageState, isExpanded, onToggleExpand, onPackageClick }) {
|
|
16653
|
+
const { package: pkg, completedCount, totalCount } = packageState;
|
|
16654
|
+
const priorityBadge = getPriorityBadge(pkg.priority);
|
|
16655
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
16656
|
+
TableRow,
|
|
16657
|
+
{
|
|
16658
|
+
className: "cursor-pointer hover:bg-muted/50 transition-colors",
|
|
16659
|
+
onClick: () => onPackageClick?.(pkg),
|
|
16660
|
+
children: [
|
|
16661
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableCell, { className: "w-10", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
16662
|
+
Button,
|
|
16663
|
+
{
|
|
16664
|
+
variant: "ghost",
|
|
16665
|
+
size: "icon",
|
|
16666
|
+
className: "h-6 w-6",
|
|
16667
|
+
onClick: (e) => {
|
|
16668
|
+
e.stopPropagation();
|
|
16669
|
+
onToggleExpand();
|
|
16670
|
+
},
|
|
16671
|
+
children: isExpanded ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "h-4 w-4" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "h-4 w-4" })
|
|
16672
|
+
}
|
|
16673
|
+
) }),
|
|
16674
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableCell, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
16675
|
+
/* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "outline", className: "text-[10px] px-1.5 py-0 shrink-0 bg-muted/50", children: "Main task" }),
|
|
16676
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium text-sm", children: pkg.name }),
|
|
16677
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs text-muted-foreground", children: [
|
|
16678
|
+
completedCount,
|
|
16679
|
+
"/",
|
|
16680
|
+
totalCount,
|
|
16681
|
+
" Completed"
|
|
16682
|
+
] })
|
|
16683
|
+
] }) }),
|
|
16684
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableCell, {}),
|
|
16685
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableCell, { className: "text-sm text-muted-foreground", children: pkg.dueDate ? formatDate4(pkg.dueDate) : "\u2014" }),
|
|
16686
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableCell, { children: /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "secondary", className: cn("text-[10px] px-1.5 py-0", priorityBadge.className), children: priorityBadge.label }) })
|
|
16687
|
+
]
|
|
16688
|
+
}
|
|
16689
|
+
);
|
|
16690
|
+
}
|
|
16691
|
+
function SubtaskRow({ subtaskState, onSubtaskAction }) {
|
|
16692
|
+
const { subtask, isLocked } = subtaskState;
|
|
16693
|
+
const statusBadge = getStatusBadge2(subtask.status, isLocked);
|
|
16694
|
+
subtask.assignee ? getPriorityBadge("medium") : getPriorityBadge("medium");
|
|
16695
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
16696
|
+
TableRow,
|
|
16697
|
+
{
|
|
16698
|
+
className: cn(
|
|
16699
|
+
"hover:bg-muted/30 transition-colors",
|
|
16700
|
+
isLocked && "opacity-60"
|
|
16701
|
+
),
|
|
16702
|
+
onClick: () => !isLocked && onSubtaskAction?.(subtask),
|
|
16703
|
+
children: [
|
|
16704
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableCell, { className: "w-10" }),
|
|
16705
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableCell, { className: "pl-10", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
16706
|
+
/* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "outline", className: "text-[10px] px-1.5 py-0 shrink-0 bg-muted/30", children: "Subtask" }),
|
|
16707
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(
|
|
16708
|
+
"text-sm",
|
|
16709
|
+
subtask.status === "done" && "text-muted-foreground",
|
|
16710
|
+
isLocked && "text-muted-foreground"
|
|
16711
|
+
), children: subtask.title })
|
|
16712
|
+
] }) }),
|
|
16713
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableCell, { children: /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "secondary", className: cn("text-[10px] px-1.5 py-0", statusBadge.className), children: statusBadge.label }) }),
|
|
16714
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableCell, { className: "text-sm text-muted-foreground", children: subtask.completedAt ? formatDate4(subtask.completedAt) : "\u2014" }),
|
|
16715
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableCell, { children: subtask.estimatedMinutes && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs text-muted-foreground", children: [
|
|
16716
|
+
"~",
|
|
16717
|
+
subtask.estimatedMinutes,
|
|
16718
|
+
"m"
|
|
16719
|
+
] }) })
|
|
16720
|
+
]
|
|
16721
|
+
}
|
|
16722
|
+
);
|
|
16723
|
+
}
|
|
16724
|
+
function TodoList({
|
|
16725
|
+
packages,
|
|
16726
|
+
workflowConfig,
|
|
16727
|
+
onSubtaskAction,
|
|
16728
|
+
onPackageClick,
|
|
16729
|
+
className
|
|
16730
|
+
}) {
|
|
16731
|
+
const [expandedIds, setExpandedIds] = React36__namespace.useState(/* @__PURE__ */ new Set());
|
|
16732
|
+
const [sort, setSort] = React36__namespace.useState({
|
|
16733
|
+
field: "priority",
|
|
16734
|
+
direction: null
|
|
16735
|
+
});
|
|
16736
|
+
const packageStates = React36__namespace.useMemo(
|
|
16737
|
+
() => computeAllPackageStates(packages, workflowConfig),
|
|
16738
|
+
[packages, workflowConfig]
|
|
16739
|
+
);
|
|
16740
|
+
const groupedPackages = React36__namespace.useMemo(
|
|
16741
|
+
() => groupPackagesByBucket(packageStates),
|
|
16742
|
+
[packageStates]
|
|
16743
|
+
);
|
|
16744
|
+
const buckets = getBucketConfig2(workflowConfig);
|
|
16745
|
+
const toggleExpand = React36__namespace.useCallback((id) => {
|
|
16746
|
+
setExpandedIds((prev) => {
|
|
16747
|
+
const next = new Set(prev);
|
|
16748
|
+
if (next.has(id)) {
|
|
16749
|
+
next.delete(id);
|
|
16750
|
+
} else {
|
|
16751
|
+
next.add(id);
|
|
16752
|
+
}
|
|
16753
|
+
return next;
|
|
16754
|
+
});
|
|
16755
|
+
}, []);
|
|
16756
|
+
const handleSort = React36__namespace.useCallback((field) => {
|
|
16757
|
+
setSort((prev) => {
|
|
16758
|
+
if (prev.field !== field) {
|
|
16759
|
+
return { field, direction: "asc" };
|
|
16760
|
+
}
|
|
16761
|
+
if (prev.direction === "asc") {
|
|
16762
|
+
return { field, direction: "desc" };
|
|
16763
|
+
}
|
|
16764
|
+
if (prev.direction === "desc") {
|
|
16765
|
+
return { field, direction: null };
|
|
16766
|
+
}
|
|
16767
|
+
return { field, direction: "asc" };
|
|
16768
|
+
});
|
|
16769
|
+
}, []);
|
|
16770
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("space-y-4", className), children: [
|
|
16771
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsxRuntime.jsxs(Badge, { variant: "outline", className: "text-sm", children: [
|
|
16772
|
+
packages.length,
|
|
16773
|
+
" packages"
|
|
16774
|
+
] }) }),
|
|
16775
|
+
/* @__PURE__ */ jsxRuntime.jsx(Card, { className: "overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsxs(ScrollArea, { className: "w-full", children: [
|
|
16776
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Table, { children: [
|
|
16777
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableHeader, { children: /* @__PURE__ */ jsxRuntime.jsxs(TableRow, { className: "bg-muted/30", children: [
|
|
16778
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableHead, { className: "w-10" }),
|
|
16779
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableHead, { className: "min-w-[300px]", children: "Task" }),
|
|
16780
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableHead, { className: "w-[120px]", children: "Status" }),
|
|
16781
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableHead, { className: "w-[140px]", children: "Due Date" }),
|
|
16782
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableHead, { className: "w-[100px]", children: "Priority" })
|
|
16783
|
+
] }) }),
|
|
16784
|
+
/* @__PURE__ */ jsxRuntime.jsxs(TableBody, { children: [
|
|
16785
|
+
buckets.map((bucket) => {
|
|
16786
|
+
const bucketPackages = groupedPackages[bucket.id] || [];
|
|
16787
|
+
if (bucketPackages.length === 0) return null;
|
|
16788
|
+
const sortedPackages = sortPackages(bucketPackages, sort.field, sort.direction);
|
|
16789
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React36__namespace.Fragment, { children: [
|
|
16790
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
16791
|
+
BucketHeaderRow,
|
|
16792
|
+
{
|
|
16793
|
+
name: bucket.name,
|
|
16794
|
+
color: bucket.color,
|
|
16795
|
+
currentSort: sort,
|
|
16796
|
+
onSort: handleSort
|
|
16797
|
+
}
|
|
16798
|
+
),
|
|
16799
|
+
sortedPackages.map((packageState) => {
|
|
16800
|
+
const isExpanded = expandedIds.has(packageState.package.id);
|
|
16801
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React36__namespace.Fragment, { children: [
|
|
16802
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
16803
|
+
PackageRow,
|
|
16804
|
+
{
|
|
16805
|
+
packageState,
|
|
16806
|
+
isExpanded,
|
|
16807
|
+
onToggleExpand: () => toggleExpand(packageState.package.id),
|
|
16808
|
+
onPackageClick
|
|
16809
|
+
}
|
|
16810
|
+
),
|
|
16811
|
+
isExpanded && packageState.subtaskStates.map((subtaskState) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
16812
|
+
SubtaskRow,
|
|
16813
|
+
{
|
|
16814
|
+
subtaskState,
|
|
16815
|
+
onSubtaskAction
|
|
16816
|
+
},
|
|
16817
|
+
subtaskState.subtask.id
|
|
16818
|
+
))
|
|
16819
|
+
] }, packageState.package.id);
|
|
16820
|
+
})
|
|
16821
|
+
] }, bucket.id);
|
|
16822
|
+
}),
|
|
16823
|
+
packages.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(TableRow, { children: /* @__PURE__ */ jsxRuntime.jsx(TableCell, { colSpan: 5, className: "h-32 text-center text-muted-foreground", children: "No packages found" }) })
|
|
16824
|
+
] })
|
|
16825
|
+
] }),
|
|
16826
|
+
/* @__PURE__ */ jsxRuntime.jsx(ScrollBar, { orientation: "horizontal" })
|
|
16827
|
+
] }) })
|
|
16828
|
+
] });
|
|
16829
|
+
}
|
|
16830
|
+
function getPriorityConfig2(priority) {
|
|
16831
|
+
switch (priority) {
|
|
16832
|
+
case "urgent":
|
|
16833
|
+
return {
|
|
16834
|
+
label: "Urgent",
|
|
16835
|
+
className: "bg-red-500/15 text-red-700 dark:bg-red-500/20 dark:text-red-400"
|
|
16836
|
+
};
|
|
16837
|
+
case "high":
|
|
16838
|
+
return {
|
|
16839
|
+
label: "High",
|
|
16840
|
+
className: "bg-orange-500/15 text-orange-700 dark:bg-orange-500/20 dark:text-orange-400"
|
|
16841
|
+
};
|
|
16842
|
+
case "medium":
|
|
16843
|
+
return {
|
|
16844
|
+
label: "Medium",
|
|
16845
|
+
className: "bg-amber-500/15 text-amber-700 dark:bg-amber-500/20 dark:text-amber-400"
|
|
16846
|
+
};
|
|
16847
|
+
case "low":
|
|
16848
|
+
return {
|
|
16849
|
+
label: "Low",
|
|
16850
|
+
className: "bg-blue-500/15 text-blue-700 dark:bg-blue-500/20 dark:text-blue-400"
|
|
16851
|
+
};
|
|
16852
|
+
default:
|
|
16853
|
+
return { label: priority, className: "" };
|
|
16854
|
+
}
|
|
16855
|
+
}
|
|
16856
|
+
function getStatusConfig2(status) {
|
|
16857
|
+
switch (status) {
|
|
16858
|
+
case "done":
|
|
16859
|
+
return {
|
|
16860
|
+
label: "Done",
|
|
16861
|
+
className: "bg-green-500/15 text-green-700 dark:bg-green-500/20 dark:text-green-400"
|
|
16862
|
+
};
|
|
16863
|
+
case "in_progress":
|
|
16864
|
+
return {
|
|
16865
|
+
label: "In Progress",
|
|
16866
|
+
className: "bg-primary/15 text-primary"
|
|
16867
|
+
};
|
|
16868
|
+
case "waiting":
|
|
16869
|
+
return {
|
|
16870
|
+
label: "Waiting",
|
|
16871
|
+
className: "bg-amber-500/15 text-amber-700 dark:bg-amber-500/20 dark:text-amber-400"
|
|
16872
|
+
};
|
|
16873
|
+
case "ready":
|
|
16874
|
+
return {
|
|
16875
|
+
label: "Ready",
|
|
16876
|
+
className: "bg-green-500/15 text-green-700 dark:bg-green-500/20 dark:text-green-400"
|
|
16877
|
+
};
|
|
16878
|
+
case "not_started":
|
|
16879
|
+
return {
|
|
16880
|
+
label: "Not Started",
|
|
16881
|
+
className: "bg-muted text-muted-foreground"
|
|
16882
|
+
};
|
|
16883
|
+
default:
|
|
16884
|
+
return { label: status, className: "" };
|
|
16885
|
+
}
|
|
16886
|
+
}
|
|
16887
|
+
function formatDate5(date) {
|
|
16888
|
+
return new Intl.DateTimeFormat("en-US", {
|
|
16889
|
+
month: "short",
|
|
16890
|
+
day: "numeric"
|
|
16891
|
+
}).format(date);
|
|
16892
|
+
}
|
|
16893
|
+
function PackageRow2({
|
|
16894
|
+
packageState,
|
|
16895
|
+
onSubtaskAction,
|
|
16896
|
+
onPackageClick,
|
|
16897
|
+
isExpanded = false,
|
|
16898
|
+
onExpandToggle,
|
|
16899
|
+
className
|
|
16900
|
+
}) {
|
|
16901
|
+
const {
|
|
16902
|
+
package: pkg,
|
|
16903
|
+
status,
|
|
16904
|
+
progress,
|
|
16905
|
+
completedCount,
|
|
16906
|
+
totalCount,
|
|
16907
|
+
nextAction,
|
|
16908
|
+
nextActionLabel,
|
|
16909
|
+
subtaskStates,
|
|
16910
|
+
isComplete,
|
|
16911
|
+
isWaiting
|
|
16912
|
+
} = packageState;
|
|
16913
|
+
const priorityConfig = getPriorityConfig2(pkg.priority);
|
|
16914
|
+
const statusConfig = getStatusConfig2(status);
|
|
16915
|
+
const lockedCount = subtaskStates.filter((s) => s.isLocked).length;
|
|
16916
|
+
const handleRowClick = React36__namespace.useCallback(() => {
|
|
16917
|
+
onPackageClick?.(pkg);
|
|
16918
|
+
}, [onPackageClick, pkg]);
|
|
16919
|
+
const handleNextAction = React36__namespace.useCallback(() => {
|
|
16920
|
+
if (nextAction && onSubtaskAction) {
|
|
16921
|
+
onSubtaskAction(nextAction.subtask);
|
|
16922
|
+
}
|
|
16923
|
+
}, [nextAction, onSubtaskAction]);
|
|
16924
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Collapsible, { open: isExpanded, onOpenChange: onExpandToggle, children: [
|
|
16925
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
16926
|
+
TableRow,
|
|
16927
|
+
{
|
|
16928
|
+
className: cn(
|
|
16929
|
+
"group cursor-pointer hover:bg-muted/50",
|
|
16930
|
+
isComplete && "opacity-70",
|
|
16931
|
+
isExpanded && "bg-muted/30",
|
|
16932
|
+
className
|
|
16933
|
+
),
|
|
16934
|
+
onClick: handleRowClick,
|
|
16935
|
+
children: [
|
|
16936
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableCell, { className: "w-10", children: /* @__PURE__ */ jsxRuntime.jsx(CollapsibleTrigger2, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
16937
|
+
Button,
|
|
16938
|
+
{
|
|
16939
|
+
variant: "ghost",
|
|
16940
|
+
size: "icon",
|
|
16941
|
+
className: "h-6 w-6",
|
|
16942
|
+
onClick: (e) => e.stopPropagation(),
|
|
16943
|
+
children: isExpanded ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "h-4 w-4" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "h-4 w-4" })
|
|
16944
|
+
}
|
|
16945
|
+
) }) }),
|
|
16946
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableCell, { className: "min-w-[200px]", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
16947
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Package, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
16948
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0", children: [
|
|
16949
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-medium text-sm truncate", children: pkg.name }),
|
|
16950
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground truncate", children: pkg.project })
|
|
16951
|
+
] })
|
|
16952
|
+
] }) }),
|
|
16953
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableCell, { className: "w-[120px]", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
16954
|
+
Badge,
|
|
16955
|
+
{
|
|
16956
|
+
variant: "secondary",
|
|
16957
|
+
className: cn("text-[10px] px-1.5 py-0", statusConfig.className),
|
|
16958
|
+
children: statusConfig.label
|
|
16959
|
+
}
|
|
16960
|
+
) }),
|
|
16961
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableCell, { className: "w-[100px]", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
16962
|
+
Badge,
|
|
16963
|
+
{
|
|
16964
|
+
variant: "secondary",
|
|
16965
|
+
className: cn("text-[10px] px-1.5 py-0", priorityConfig.className),
|
|
16966
|
+
children: priorityConfig.label
|
|
16967
|
+
}
|
|
16968
|
+
) }),
|
|
16969
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableCell, { className: "w-[150px]", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
|
|
16970
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between text-xs", children: [
|
|
16971
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-muted-foreground", children: [
|
|
16972
|
+
completedCount,
|
|
16973
|
+
"/",
|
|
16974
|
+
totalCount
|
|
16975
|
+
] }),
|
|
16976
|
+
lockedCount > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-0.5 text-amber-600 dark:text-amber-400", children: [
|
|
16977
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertCircle, { className: "h-3 w-3" }),
|
|
16978
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: lockedCount })
|
|
16979
|
+
] })
|
|
16980
|
+
] }),
|
|
16981
|
+
/* @__PURE__ */ jsxRuntime.jsx(Progress, { value: progress * 100, className: "h-1.5" })
|
|
16982
|
+
] }) }),
|
|
16983
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableCell, { className: "w-[100px]", children: pkg.dueDate && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 text-xs text-muted-foreground", children: [
|
|
16984
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.CalendarDays, { className: "h-3 w-3" }),
|
|
16985
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: formatDate5(pkg.dueDate) })
|
|
16986
|
+
] }) }),
|
|
16987
|
+
/* @__PURE__ */ jsxRuntime.jsx(TableCell, { className: "w-[150px]", children: isWaiting ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
16988
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 text-xs text-muted-foreground", children: [
|
|
16989
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Clock, { className: "h-3 w-3" }),
|
|
16990
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Waiting" })
|
|
16991
|
+
] }),
|
|
16992
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
16993
|
+
Button,
|
|
16994
|
+
{
|
|
16995
|
+
variant: "ghost",
|
|
16996
|
+
size: "sm",
|
|
16997
|
+
className: "h-6 text-[10px] px-2",
|
|
16998
|
+
onClick: (e) => {
|
|
16999
|
+
e.stopPropagation();
|
|
17000
|
+
onPackageClick?.(pkg);
|
|
17001
|
+
},
|
|
17002
|
+
children: [
|
|
17003
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ExternalLink, { className: "h-3 w-3 mr-1" }),
|
|
17004
|
+
"View"
|
|
17005
|
+
]
|
|
17006
|
+
}
|
|
17007
|
+
)
|
|
17008
|
+
] }) : nextAction ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
17009
|
+
Button,
|
|
17010
|
+
{
|
|
17011
|
+
size: "sm",
|
|
17012
|
+
variant: "default",
|
|
17013
|
+
className: "h-6 text-[10px] px-2",
|
|
17014
|
+
onClick: (e) => {
|
|
17015
|
+
e.stopPropagation();
|
|
17016
|
+
handleNextAction();
|
|
17017
|
+
},
|
|
17018
|
+
children: nextActionLabel
|
|
17019
|
+
}
|
|
17020
|
+
) : isComplete ? /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "outline", className: "text-[10px] px-1.5 py-0 bg-green-500/10 text-green-600 border-green-500/20", children: "Complete" }) : null })
|
|
17021
|
+
]
|
|
17022
|
+
}
|
|
17023
|
+
),
|
|
17024
|
+
/* @__PURE__ */ jsxRuntime.jsx(CollapsibleContent2, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("tr", { children: /* @__PURE__ */ jsxRuntime.jsx("td", { colSpan: 7, className: "p-0", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-muted/20 border-t border-b", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-4 space-y-2 max-w-3xl ml-10", children: [
|
|
17025
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs font-medium text-muted-foreground mb-3", children: [
|
|
17026
|
+
"Subtasks (",
|
|
17027
|
+
subtaskStates.length,
|
|
17028
|
+
")"
|
|
17029
|
+
] }),
|
|
17030
|
+
subtaskStates.map((subtaskState) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
17031
|
+
SubtaskItem,
|
|
17032
|
+
{
|
|
17033
|
+
subtaskState,
|
|
17034
|
+
onAction: onSubtaskAction
|
|
17035
|
+
},
|
|
17036
|
+
subtaskState.subtask.id
|
|
17037
|
+
))
|
|
17038
|
+
] }) }) }) }) })
|
|
17039
|
+
] });
|
|
17040
|
+
}
|
|
17041
|
+
function WorkflowViewToggle({
|
|
17042
|
+
value,
|
|
17043
|
+
onValueChange,
|
|
17044
|
+
className
|
|
17045
|
+
}) {
|
|
17046
|
+
const handleValueChange = React36__namespace.useCallback(
|
|
17047
|
+
(newValue) => {
|
|
17048
|
+
if (newValue === "kanban" || newValue === "list") {
|
|
17049
|
+
onValueChange(newValue);
|
|
17050
|
+
}
|
|
17051
|
+
},
|
|
17052
|
+
[onValueChange]
|
|
17053
|
+
);
|
|
17054
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
17055
|
+
ToggleGroup,
|
|
17056
|
+
{
|
|
17057
|
+
type: "single",
|
|
17058
|
+
value,
|
|
17059
|
+
onValueChange: handleValueChange,
|
|
17060
|
+
className: cn("border rounded-lg p-0.5 bg-muted/50", className),
|
|
17061
|
+
children: [
|
|
17062
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Tooltip2, { children: [
|
|
17063
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
17064
|
+
ToggleGroupItem,
|
|
17065
|
+
{
|
|
17066
|
+
value: "kanban",
|
|
17067
|
+
"aria-label": "Kanban view",
|
|
17068
|
+
className: cn(
|
|
17069
|
+
"h-8 w-8 p-0 data-[state=on]:bg-background data-[state=on]:shadow-sm",
|
|
17070
|
+
"rounded-md"
|
|
17071
|
+
),
|
|
17072
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Kanban, { className: "h-4 w-4" })
|
|
17073
|
+
}
|
|
17074
|
+
) }),
|
|
17075
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { side: "bottom", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs", children: "Kanban View" }) })
|
|
17076
|
+
] }),
|
|
17077
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Tooltip2, { children: [
|
|
17078
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
17079
|
+
ToggleGroupItem,
|
|
17080
|
+
{
|
|
17081
|
+
value: "list",
|
|
17082
|
+
"aria-label": "List view",
|
|
17083
|
+
className: cn(
|
|
17084
|
+
"h-8 w-8 p-0 data-[state=on]:bg-background data-[state=on]:shadow-sm",
|
|
17085
|
+
"rounded-md"
|
|
17086
|
+
),
|
|
17087
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.List, { className: "h-4 w-4" })
|
|
17088
|
+
}
|
|
17089
|
+
) }),
|
|
17090
|
+
/* @__PURE__ */ jsxRuntime.jsx(TooltipContent, { side: "bottom", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs", children: "List View" }) })
|
|
17091
|
+
] })
|
|
17092
|
+
]
|
|
17093
|
+
}
|
|
17094
|
+
) });
|
|
17095
|
+
}
|
|
15735
17096
|
|
|
15736
17097
|
// src/components/event-calendar/types.ts
|
|
15737
17098
|
var DEFAULT_WORKING_HOURS = {
|
|
@@ -15795,7 +17156,7 @@ var BADGE_VARIANT_LABELS = {
|
|
|
15795
17156
|
colored: "Colored",
|
|
15796
17157
|
mixed: "Mixed"
|
|
15797
17158
|
};
|
|
15798
|
-
var CalendarContext =
|
|
17159
|
+
var CalendarContext = React36__namespace.createContext(null);
|
|
15799
17160
|
function EventCalendarProvider({
|
|
15800
17161
|
children,
|
|
15801
17162
|
events: initialEvents = [],
|
|
@@ -15810,38 +17171,38 @@ function EventCalendarProvider({
|
|
|
15810
17171
|
onEventUpdate,
|
|
15811
17172
|
onEventDelete
|
|
15812
17173
|
}) {
|
|
15813
|
-
const [selectedDate, setSelectedDate] =
|
|
15814
|
-
const [selectedUserId, setSelectedUserId] =
|
|
15815
|
-
const [events, setEventsState] =
|
|
15816
|
-
const [users] =
|
|
15817
|
-
const [badgeVariant, setBadgeVariant] =
|
|
15818
|
-
const [view, setView] =
|
|
15819
|
-
const [workingHours, setWorkingHours] =
|
|
15820
|
-
const [visibleHours, setVisibleHours] =
|
|
15821
|
-
|
|
17174
|
+
const [selectedDate, setSelectedDate] = React36__namespace.useState(defaultDate);
|
|
17175
|
+
const [selectedUserId, setSelectedUserId] = React36__namespace.useState(defaultUserId);
|
|
17176
|
+
const [events, setEventsState] = React36__namespace.useState(initialEvents);
|
|
17177
|
+
const [users] = React36__namespace.useState(initialUsers);
|
|
17178
|
+
const [badgeVariant, setBadgeVariant] = React36__namespace.useState(defaultBadgeVariant);
|
|
17179
|
+
const [view, setView] = React36__namespace.useState(defaultView);
|
|
17180
|
+
const [workingHours, setWorkingHours] = React36__namespace.useState(defaultWorkingHours);
|
|
17181
|
+
const [visibleHours, setVisibleHours] = React36__namespace.useState(defaultVisibleHours);
|
|
17182
|
+
React36__namespace.useEffect(() => {
|
|
15822
17183
|
setEventsState(initialEvents);
|
|
15823
17184
|
}, [initialEvents]);
|
|
15824
|
-
const setEvents =
|
|
17185
|
+
const setEvents = React36__namespace.useCallback((newEvents) => {
|
|
15825
17186
|
setEventsState(newEvents);
|
|
15826
17187
|
}, []);
|
|
15827
|
-
const addEvent =
|
|
17188
|
+
const addEvent = React36__namespace.useCallback((event) => {
|
|
15828
17189
|
setEventsState((prev) => [...prev, event]);
|
|
15829
17190
|
onEventAdd?.(event);
|
|
15830
17191
|
}, [onEventAdd]);
|
|
15831
|
-
const updateEvent =
|
|
17192
|
+
const updateEvent = React36__namespace.useCallback((event) => {
|
|
15832
17193
|
setEventsState(
|
|
15833
17194
|
(prev) => prev.map((e) => e.id === event.id ? event : e)
|
|
15834
17195
|
);
|
|
15835
17196
|
onEventUpdate?.(event);
|
|
15836
17197
|
}, [onEventUpdate]);
|
|
15837
|
-
const deleteEvent =
|
|
17198
|
+
const deleteEvent = React36__namespace.useCallback((eventId) => {
|
|
15838
17199
|
setEventsState((prev) => prev.filter((e) => e.id !== eventId));
|
|
15839
17200
|
onEventDelete?.(eventId);
|
|
15840
17201
|
}, [onEventDelete]);
|
|
15841
|
-
const goToToday =
|
|
17202
|
+
const goToToday = React36__namespace.useCallback(() => {
|
|
15842
17203
|
setSelectedDate(/* @__PURE__ */ new Date());
|
|
15843
17204
|
}, []);
|
|
15844
|
-
const goToPrevious =
|
|
17205
|
+
const goToPrevious = React36__namespace.useCallback(() => {
|
|
15845
17206
|
setSelectedDate((current) => {
|
|
15846
17207
|
switch (view) {
|
|
15847
17208
|
case "day":
|
|
@@ -15859,7 +17220,7 @@ function EventCalendarProvider({
|
|
|
15859
17220
|
}
|
|
15860
17221
|
});
|
|
15861
17222
|
}, [view]);
|
|
15862
|
-
const goToNext =
|
|
17223
|
+
const goToNext = React36__namespace.useCallback(() => {
|
|
15863
17224
|
setSelectedDate((current) => {
|
|
15864
17225
|
switch (view) {
|
|
15865
17226
|
case "day":
|
|
@@ -15877,7 +17238,7 @@ function EventCalendarProvider({
|
|
|
15877
17238
|
}
|
|
15878
17239
|
});
|
|
15879
17240
|
}, [view]);
|
|
15880
|
-
const contextValue =
|
|
17241
|
+
const contextValue = React36__namespace.useMemo(
|
|
15881
17242
|
() => ({
|
|
15882
17243
|
// State
|
|
15883
17244
|
selectedDate,
|
|
@@ -15924,7 +17285,7 @@ function EventCalendarProvider({
|
|
|
15924
17285
|
return /* @__PURE__ */ jsxRuntime.jsx(CalendarContext.Provider, { value: contextValue, children });
|
|
15925
17286
|
}
|
|
15926
17287
|
function useEventCalendar() {
|
|
15927
|
-
const context =
|
|
17288
|
+
const context = React36__namespace.useContext(CalendarContext);
|
|
15928
17289
|
if (!context) {
|
|
15929
17290
|
throw new Error("useEventCalendar must be used within an EventCalendarProvider");
|
|
15930
17291
|
}
|
|
@@ -15932,14 +17293,14 @@ function useEventCalendar() {
|
|
|
15932
17293
|
}
|
|
15933
17294
|
function useFilteredEvents() {
|
|
15934
17295
|
const { events, selectedUserId } = useEventCalendar();
|
|
15935
|
-
return
|
|
17296
|
+
return React36__namespace.useMemo(() => {
|
|
15936
17297
|
if (!selectedUserId) return events;
|
|
15937
17298
|
return events.filter((event) => event.user.id === selectedUserId);
|
|
15938
17299
|
}, [events, selectedUserId]);
|
|
15939
17300
|
}
|
|
15940
17301
|
function useEventsInRange(startDate, endDate) {
|
|
15941
17302
|
const filteredEvents = useFilteredEvents();
|
|
15942
|
-
return
|
|
17303
|
+
return React36__namespace.useMemo(() => {
|
|
15943
17304
|
return filteredEvents.filter((event) => {
|
|
15944
17305
|
const eventStart = new Date(event.startDate);
|
|
15945
17306
|
const eventEnd = new Date(event.endDate);
|
|
@@ -16497,8 +17858,8 @@ function MoreEvents({ count, onClick, className }) {
|
|
|
16497
17858
|
);
|
|
16498
17859
|
}
|
|
16499
17860
|
function TimeIndicator({ className }) {
|
|
16500
|
-
const [now, setNow] =
|
|
16501
|
-
|
|
17861
|
+
const [now, setNow] = React36__namespace.useState(/* @__PURE__ */ new Date());
|
|
17862
|
+
React36__namespace.useEffect(() => {
|
|
16502
17863
|
const interval = setInterval(() => setNow(/* @__PURE__ */ new Date()), 6e4);
|
|
16503
17864
|
return () => clearInterval(interval);
|
|
16504
17865
|
}, []);
|
|
@@ -16535,24 +17896,24 @@ function DateBadge({ date, className }) {
|
|
|
16535
17896
|
}
|
|
16536
17897
|
);
|
|
16537
17898
|
}
|
|
16538
|
-
var DragContext =
|
|
17899
|
+
var DragContext = React36__namespace.createContext(null);
|
|
16539
17900
|
function DragProvider({
|
|
16540
17901
|
children,
|
|
16541
17902
|
snapMinutes = 15,
|
|
16542
17903
|
onDragStart,
|
|
16543
17904
|
onDragEnd
|
|
16544
17905
|
}) {
|
|
16545
|
-
const [draggedEvent, setDraggedEventState] =
|
|
16546
|
-
const [isDragging, setIsDragging] =
|
|
17906
|
+
const [draggedEvent, setDraggedEventState] = React36__namespace.useState(null);
|
|
17907
|
+
const [isDragging, setIsDragging] = React36__namespace.useState(false);
|
|
16547
17908
|
const { updateEvent } = useEventCalendar();
|
|
16548
|
-
const setDraggedEvent =
|
|
17909
|
+
const setDraggedEvent = React36__namespace.useCallback((event) => {
|
|
16549
17910
|
setDraggedEventState(event);
|
|
16550
17911
|
setIsDragging(!!event);
|
|
16551
17912
|
if (event) {
|
|
16552
17913
|
onDragStart?.(event);
|
|
16553
17914
|
}
|
|
16554
17915
|
}, [onDragStart]);
|
|
16555
|
-
const handleDrop =
|
|
17916
|
+
const handleDrop = React36__namespace.useCallback((newStartDate) => {
|
|
16556
17917
|
if (!draggedEvent) return;
|
|
16557
17918
|
const snappedDate = snapToInterval(newStartDate, snapMinutes);
|
|
16558
17919
|
const { startDate, endDate } = calculateDropDates(draggedEvent, snappedDate);
|
|
@@ -16565,7 +17926,7 @@ function DragProvider({
|
|
|
16565
17926
|
onDragEnd?.(updatedEvent, new Date(startDate), new Date(endDate));
|
|
16566
17927
|
setDraggedEvent(null);
|
|
16567
17928
|
}, [draggedEvent, snapMinutes, updateEvent, onDragEnd, setDraggedEvent]);
|
|
16568
|
-
const contextValue =
|
|
17929
|
+
const contextValue = React36__namespace.useMemo(
|
|
16569
17930
|
() => ({
|
|
16570
17931
|
draggedEvent,
|
|
16571
17932
|
setDraggedEvent,
|
|
@@ -16576,7 +17937,7 @@ function DragProvider({
|
|
|
16576
17937
|
return /* @__PURE__ */ jsxRuntime.jsx(DragContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(DragDropHandler, { onDrop: handleDrop, children }) });
|
|
16577
17938
|
}
|
|
16578
17939
|
function useDrag() {
|
|
16579
|
-
const context =
|
|
17940
|
+
const context = React36__namespace.useContext(DragContext);
|
|
16580
17941
|
if (!context) {
|
|
16581
17942
|
throw new Error("useDrag must be used within a DragProvider");
|
|
16582
17943
|
}
|
|
@@ -16621,7 +17982,7 @@ function DroppableZone({
|
|
|
16621
17982
|
}) {
|
|
16622
17983
|
const { draggedEvent, setDraggedEvent } = useDrag();
|
|
16623
17984
|
const { updateEvent } = useEventCalendar();
|
|
16624
|
-
const [isOver, setIsOver] =
|
|
17985
|
+
const [isOver, setIsOver] = React36__namespace.useState(false);
|
|
16625
17986
|
const handleDragOver = (e) => {
|
|
16626
17987
|
e.preventDefault();
|
|
16627
17988
|
e.dataTransfer.dropEffect = "move";
|
|
@@ -16659,23 +18020,23 @@ function DroppableZone({
|
|
|
16659
18020
|
function useDroppable({ date, hour, minute = 0, onDrop }) {
|
|
16660
18021
|
const { draggedEvent, setDraggedEvent } = useDrag();
|
|
16661
18022
|
const { updateEvent } = useEventCalendar();
|
|
16662
|
-
const [isOver, setIsOver] =
|
|
16663
|
-
const dropTargetDate =
|
|
18023
|
+
const [isOver, setIsOver] = React36__namespace.useState(false);
|
|
18024
|
+
const dropTargetDate = React36__namespace.useMemo(() => {
|
|
16664
18025
|
const targetDate = new Date(date);
|
|
16665
18026
|
if (hour !== void 0) {
|
|
16666
18027
|
targetDate.setHours(hour, minute, 0, 0);
|
|
16667
18028
|
}
|
|
16668
18029
|
return targetDate;
|
|
16669
18030
|
}, [date, hour, minute]);
|
|
16670
|
-
const handleDragOver =
|
|
18031
|
+
const handleDragOver = React36__namespace.useCallback((e) => {
|
|
16671
18032
|
e.preventDefault();
|
|
16672
18033
|
e.dataTransfer.dropEffect = "move";
|
|
16673
18034
|
if (!isOver) setIsOver(true);
|
|
16674
18035
|
}, [isOver]);
|
|
16675
|
-
const handleDragLeave =
|
|
18036
|
+
const handleDragLeave = React36__namespace.useCallback(() => {
|
|
16676
18037
|
setIsOver(false);
|
|
16677
18038
|
}, []);
|
|
16678
|
-
const handleDrop =
|
|
18039
|
+
const handleDrop = React36__namespace.useCallback((e) => {
|
|
16679
18040
|
e.preventDefault();
|
|
16680
18041
|
setIsOver(false);
|
|
16681
18042
|
if (!draggedEvent) return;
|
|
@@ -16702,13 +18063,13 @@ function useDroppable({ date, hour, minute = 0, onDrop }) {
|
|
|
16702
18063
|
function useDraggable3(event, disabled = false) {
|
|
16703
18064
|
const { setDraggedEvent, draggedEvent } = useDrag();
|
|
16704
18065
|
const isDragged = draggedEvent?.id === event.id;
|
|
16705
|
-
const handleDragStart =
|
|
18066
|
+
const handleDragStart = React36__namespace.useCallback((e) => {
|
|
16706
18067
|
if (disabled) return;
|
|
16707
18068
|
e.dataTransfer.effectAllowed = "move";
|
|
16708
18069
|
e.dataTransfer.setData("text/plain", event.id);
|
|
16709
18070
|
setDraggedEvent(event);
|
|
16710
18071
|
}, [disabled, event, setDraggedEvent]);
|
|
16711
|
-
const handleDragEnd =
|
|
18072
|
+
const handleDragEnd = React36__namespace.useCallback(() => {
|
|
16712
18073
|
setDraggedEvent(null);
|
|
16713
18074
|
}, [setDraggedEvent]);
|
|
16714
18075
|
return {
|
|
@@ -16749,15 +18110,15 @@ function MonthView({
|
|
|
16749
18110
|
}) {
|
|
16750
18111
|
const { selectedDate, badgeVariant, setSelectedDate, setView } = useEventCalendar();
|
|
16751
18112
|
const filteredEvents = useFilteredEvents();
|
|
16752
|
-
const { singleDayEvents, multiDayEvents } =
|
|
18113
|
+
const { singleDayEvents, multiDayEvents } = React36__namespace.useMemo(
|
|
16753
18114
|
() => splitEventsByDuration(filteredEvents),
|
|
16754
18115
|
[filteredEvents]
|
|
16755
18116
|
);
|
|
16756
|
-
const cells =
|
|
18117
|
+
const cells = React36__namespace.useMemo(
|
|
16757
18118
|
() => getCalendarCells(selectedDate),
|
|
16758
18119
|
[selectedDate]
|
|
16759
18120
|
);
|
|
16760
|
-
const eventPositions =
|
|
18121
|
+
const eventPositions = React36__namespace.useMemo(
|
|
16761
18122
|
() => calculateMonthEventPositions(multiDayEvents, singleDayEvents, selectedDate),
|
|
16762
18123
|
[multiDayEvents, singleDayEvents, selectedDate]
|
|
16763
18124
|
);
|
|
@@ -16939,7 +18300,7 @@ function WeekView({
|
|
|
16939
18300
|
visibleHours
|
|
16940
18301
|
} = useEventCalendar();
|
|
16941
18302
|
const filteredEvents = useFilteredEvents();
|
|
16942
|
-
const { singleDayEvents, multiDayEvents } =
|
|
18303
|
+
const { singleDayEvents, multiDayEvents } = React36__namespace.useMemo(
|
|
16943
18304
|
() => splitEventsByDuration(filteredEvents),
|
|
16944
18305
|
[filteredEvents]
|
|
16945
18306
|
);
|
|
@@ -17145,8 +18506,8 @@ function CalendarTimeline({
|
|
|
17145
18506
|
firstVisibleHour,
|
|
17146
18507
|
lastVisibleHour
|
|
17147
18508
|
}) {
|
|
17148
|
-
const [currentTime, setCurrentTime] =
|
|
17149
|
-
|
|
18509
|
+
const [currentTime, setCurrentTime] = React36__namespace.useState(/* @__PURE__ */ new Date());
|
|
18510
|
+
React36__namespace.useEffect(() => {
|
|
17150
18511
|
const interval = setInterval(() => {
|
|
17151
18512
|
setCurrentTime(/* @__PURE__ */ new Date());
|
|
17152
18513
|
}, 6e4);
|
|
@@ -17229,7 +18590,7 @@ function DayView({
|
|
|
17229
18590
|
visibleHours
|
|
17230
18591
|
} = useEventCalendar();
|
|
17231
18592
|
const filteredEvents = useFilteredEvents();
|
|
17232
|
-
const { singleDayEvents, multiDayEvents } =
|
|
18593
|
+
const { singleDayEvents, multiDayEvents } = React36__namespace.useMemo(
|
|
17233
18594
|
() => splitEventsByDuration(filteredEvents),
|
|
17234
18595
|
[filteredEvents]
|
|
17235
18596
|
);
|
|
@@ -17237,7 +18598,7 @@ function DayView({
|
|
|
17237
18598
|
visibleHours,
|
|
17238
18599
|
singleDayEvents
|
|
17239
18600
|
);
|
|
17240
|
-
const currentEvents =
|
|
18601
|
+
const currentEvents = React36__namespace.useMemo(() => {
|
|
17241
18602
|
if (!dateFns.isToday(selectedDate)) return [];
|
|
17242
18603
|
return getCurrentEvents(singleDayEvents);
|
|
17243
18604
|
}, [singleDayEvents, selectedDate]);
|
|
@@ -17461,8 +18822,8 @@ function CalendarTimeline2({
|
|
|
17461
18822
|
firstVisibleHour,
|
|
17462
18823
|
lastVisibleHour
|
|
17463
18824
|
}) {
|
|
17464
|
-
const [currentTime, setCurrentTime] =
|
|
17465
|
-
|
|
18825
|
+
const [currentTime, setCurrentTime] = React36__namespace.useState(/* @__PURE__ */ new Date());
|
|
18826
|
+
React36__namespace.useEffect(() => {
|
|
17466
18827
|
const interval = setInterval(() => {
|
|
17467
18828
|
setCurrentTime(/* @__PURE__ */ new Date());
|
|
17468
18829
|
}, 6e4);
|
|
@@ -17496,7 +18857,7 @@ function YearView({
|
|
|
17496
18857
|
}) {
|
|
17497
18858
|
const { selectedDate, setSelectedDate, setView } = useEventCalendar();
|
|
17498
18859
|
const filteredEvents = useFilteredEvents();
|
|
17499
|
-
const months =
|
|
18860
|
+
const months = React36__namespace.useMemo(() => {
|
|
17500
18861
|
const yearStart = dateFns.startOfYear(selectedDate);
|
|
17501
18862
|
return Array.from({ length: 12 }, (_, i) => dateFns.addMonths(yearStart, i));
|
|
17502
18863
|
}, [selectedDate]);
|
|
@@ -17619,11 +18980,11 @@ function AgendaView({
|
|
|
17619
18980
|
}) {
|
|
17620
18981
|
const { selectedDate, setSelectedDate, setView } = useEventCalendar();
|
|
17621
18982
|
const filteredEvents = useFilteredEvents();
|
|
17622
|
-
const { singleDayEvents, multiDayEvents } =
|
|
18983
|
+
const { singleDayEvents, multiDayEvents } = React36__namespace.useMemo(
|
|
17623
18984
|
() => splitEventsByDuration(filteredEvents),
|
|
17624
18985
|
[filteredEvents]
|
|
17625
18986
|
);
|
|
17626
|
-
const eventsByDay =
|
|
18987
|
+
const eventsByDay = React36__namespace.useMemo(() => {
|
|
17627
18988
|
const allDates = /* @__PURE__ */ new Map();
|
|
17628
18989
|
singleDayEvents.forEach((event) => {
|
|
17629
18990
|
const eventDate = dateFns.parseISO(event.startDate);
|
|
@@ -18088,16 +19449,16 @@ function EventDialog({
|
|
|
18088
19449
|
defaultUserId
|
|
18089
19450
|
}) {
|
|
18090
19451
|
const { addEvent, updateEvent, deleteEvent, users } = useEventCalendar();
|
|
18091
|
-
const [title, setTitle] =
|
|
18092
|
-
const [description, setDescription] =
|
|
18093
|
-
const [startDate, setStartDate] =
|
|
18094
|
-
const [startTime, setStartTime] =
|
|
18095
|
-
const [endDate, setEndDate] =
|
|
18096
|
-
const [endTime, setEndTime] =
|
|
18097
|
-
const [color, setColor] =
|
|
18098
|
-
const [userId, setUserId] =
|
|
18099
|
-
const [isSubmitting, setIsSubmitting] =
|
|
18100
|
-
|
|
19452
|
+
const [title, setTitle] = React36__namespace.useState("");
|
|
19453
|
+
const [description, setDescription] = React36__namespace.useState("");
|
|
19454
|
+
const [startDate, setStartDate] = React36__namespace.useState("");
|
|
19455
|
+
const [startTime, setStartTime] = React36__namespace.useState("");
|
|
19456
|
+
const [endDate, setEndDate] = React36__namespace.useState("");
|
|
19457
|
+
const [endTime, setEndTime] = React36__namespace.useState("");
|
|
19458
|
+
const [color, setColor] = React36__namespace.useState("blue");
|
|
19459
|
+
const [userId, setUserId] = React36__namespace.useState("");
|
|
19460
|
+
const [isSubmitting, setIsSubmitting] = React36__namespace.useState(false);
|
|
19461
|
+
React36__namespace.useEffect(() => {
|
|
18101
19462
|
if (open) {
|
|
18102
19463
|
if (mode === "edit" && event) {
|
|
18103
19464
|
const start = dateFns.parseISO(event.startDate);
|
|
@@ -18320,7 +19681,7 @@ function QuickAddEvent({
|
|
|
18320
19681
|
onOpenDialog,
|
|
18321
19682
|
onClose
|
|
18322
19683
|
}) {
|
|
18323
|
-
const [title, setTitle] =
|
|
19684
|
+
const [title, setTitle] = React36__namespace.useState("");
|
|
18324
19685
|
const { users } = useEventCalendar();
|
|
18325
19686
|
const handleSubmit = (e) => {
|
|
18326
19687
|
e.preventDefault();
|
|
@@ -18387,8 +19748,8 @@ var HOUR_OPTIONS = Array.from({ length: 25 }, (_, i) => {
|
|
|
18387
19748
|
});
|
|
18388
19749
|
function ChangeVisibleHoursInput() {
|
|
18389
19750
|
const { visibleHours, setVisibleHours } = useEventCalendar();
|
|
18390
|
-
const [from, setFrom] =
|
|
18391
|
-
const [to, setTo] =
|
|
19751
|
+
const [from, setFrom] = React36__namespace.useState(visibleHours.from);
|
|
19752
|
+
const [to, setTo] = React36__namespace.useState(visibleHours.to);
|
|
18392
19753
|
const handleApply = () => {
|
|
18393
19754
|
const toHour = to === 0 ? 24 : to;
|
|
18394
19755
|
setVisibleHours({ from, to: toHour });
|
|
@@ -18434,7 +19795,7 @@ var HOUR_OPTIONS2 = Array.from({ length: 25 }, (_, i) => {
|
|
|
18434
19795
|
});
|
|
18435
19796
|
function ChangeWorkingHoursInput() {
|
|
18436
19797
|
const { workingHours, setWorkingHours } = useEventCalendar();
|
|
18437
|
-
const [localWorkingHours, setLocalWorkingHours] =
|
|
19798
|
+
const [localWorkingHours, setLocalWorkingHours] = React36__namespace.useState({
|
|
18438
19799
|
...workingHours
|
|
18439
19800
|
});
|
|
18440
19801
|
const handleToggleDay = (dayId) => {
|
|
@@ -18583,8 +19944,8 @@ function CalendarSettingsButton({
|
|
|
18583
19944
|
);
|
|
18584
19945
|
}
|
|
18585
19946
|
function useMediaQuery(query) {
|
|
18586
|
-
const [matches, setMatches] =
|
|
18587
|
-
|
|
19947
|
+
const [matches, setMatches] = React36__namespace.useState(false);
|
|
19948
|
+
React36__namespace.useEffect(() => {
|
|
18588
19949
|
const media = window.matchMedia(query);
|
|
18589
19950
|
setMatches(media.matches);
|
|
18590
19951
|
const listener = (event) => {
|
|
@@ -18636,11 +19997,11 @@ function BigCalendarInner({
|
|
|
18636
19997
|
maxEventsPerDay
|
|
18637
19998
|
}) {
|
|
18638
19999
|
const { view, setView } = useEventCalendar();
|
|
18639
|
-
const [dialogOpen, setDialogOpen] =
|
|
18640
|
-
const [settingsDialogOpen, setSettingsDialogOpen] =
|
|
18641
|
-
const [selectedEvent, setSelectedEvent] =
|
|
18642
|
-
const [dialogMode, setDialogMode] =
|
|
18643
|
-
const [defaultDate, setDefaultDate] =
|
|
20000
|
+
const [dialogOpen, setDialogOpen] = React36__namespace.useState(false);
|
|
20001
|
+
const [settingsDialogOpen, setSettingsDialogOpen] = React36__namespace.useState(false);
|
|
20002
|
+
const [selectedEvent, setSelectedEvent] = React36__namespace.useState(null);
|
|
20003
|
+
const [dialogMode, setDialogMode] = React36__namespace.useState("add");
|
|
20004
|
+
const [defaultDate, setDefaultDate] = React36__namespace.useState(/* @__PURE__ */ new Date());
|
|
18644
20005
|
const isMobile = useMediaQuery("(max-width: 768px)");
|
|
18645
20006
|
const isCompact = compact === "auto" ? isMobile : compact;
|
|
18646
20007
|
const handleAddClick = () => {
|
|
@@ -18799,7 +20160,7 @@ function CalendarView({
|
|
|
18799
20160
|
}
|
|
18800
20161
|
}
|
|
18801
20162
|
var t = tunnel__default.default();
|
|
18802
|
-
var KanbanContext =
|
|
20163
|
+
var KanbanContext = React36.createContext({
|
|
18803
20164
|
columns: [],
|
|
18804
20165
|
data: [],
|
|
18805
20166
|
activeCardId: null
|
|
@@ -18837,7 +20198,7 @@ var KanbanCard = ({
|
|
|
18837
20198
|
} = sortable.useSortable({
|
|
18838
20199
|
id
|
|
18839
20200
|
});
|
|
18840
|
-
const { activeCardId } =
|
|
20201
|
+
const { activeCardId } = React36.useContext(KanbanContext);
|
|
18841
20202
|
const style = {
|
|
18842
20203
|
transition,
|
|
18843
20204
|
transform: utilities.CSS.Transform.toString(transform)
|
|
@@ -18872,7 +20233,7 @@ var KanbanCards = ({
|
|
|
18872
20233
|
className,
|
|
18873
20234
|
...props
|
|
18874
20235
|
}) => {
|
|
18875
|
-
const { data } =
|
|
20236
|
+
const { data } = React36.useContext(KanbanContext);
|
|
18876
20237
|
const filteredData = data.filter((item) => item.column === props.id);
|
|
18877
20238
|
const items = filteredData.map((item) => item.id);
|
|
18878
20239
|
return /* @__PURE__ */ jsxRuntime.jsxs(ScrollArea, { className: "overflow-hidden", children: [
|
|
@@ -18899,7 +20260,7 @@ var KanbanProvider = ({
|
|
|
18899
20260
|
onDataChange,
|
|
18900
20261
|
...props
|
|
18901
20262
|
}) => {
|
|
18902
|
-
const [activeCardId, setActiveCardId] =
|
|
20263
|
+
const [activeCardId, setActiveCardId] = React36.useState(null);
|
|
18903
20264
|
const sensors = core.useSensors(
|
|
18904
20265
|
core.useSensor(core.MouseSensor),
|
|
18905
20266
|
core.useSensor(core.TouchSensor),
|
|
@@ -19319,6 +20680,8 @@ exports.NavigationMenuTrigger = NavigationMenuTrigger;
|
|
|
19319
20680
|
exports.NavigationMenuViewport = NavigationMenuViewport;
|
|
19320
20681
|
exports.NetBadge = NetBadge;
|
|
19321
20682
|
exports.PHASE_COLORS = PHASE_COLORS;
|
|
20683
|
+
exports.PackageCard = PackageCard;
|
|
20684
|
+
exports.PackageRow = PackageRow2;
|
|
19322
20685
|
exports.Pagination = Pagination;
|
|
19323
20686
|
exports.PaginationContent = PaginationContent;
|
|
19324
20687
|
exports.PaginationEllipsis = PaginationEllipsis;
|
|
@@ -19419,6 +20782,7 @@ exports.Slider = Slider;
|
|
|
19419
20782
|
exports.Spinner = Spinner;
|
|
19420
20783
|
exports.StatusProgress = StatusProgress;
|
|
19421
20784
|
exports.SubmitCalibrationBar = SubmitCalibrationBar;
|
|
20785
|
+
exports.SubtaskItem = SubtaskItem;
|
|
19422
20786
|
exports.SupplierCell = SupplierCell;
|
|
19423
20787
|
exports.SupplierWeeklyLoading = SupplierWeeklyLoading;
|
|
19424
20788
|
exports.Switch = Switch;
|
|
@@ -19438,6 +20802,8 @@ exports.Textarea = Textarea;
|
|
|
19438
20802
|
exports.ThemeSwitch = ThemeSwitch;
|
|
19439
20803
|
exports.TimeIndicator = TimeIndicator;
|
|
19440
20804
|
exports.Toaster = Toaster;
|
|
20805
|
+
exports.TodoBoard = TodoBoard;
|
|
20806
|
+
exports.TodoList = TodoList;
|
|
19441
20807
|
exports.Toggle = Toggle;
|
|
19442
20808
|
exports.ToggleGroup = ToggleGroup;
|
|
19443
20809
|
exports.ToggleGroupItem = ToggleGroupItem;
|
|
@@ -19457,7 +20823,11 @@ exports.WeekDetailSheet = WeekDetailSheet;
|
|
|
19457
20823
|
exports.WeekHeader = WeekHeader;
|
|
19458
20824
|
exports.WeekView = WeekView;
|
|
19459
20825
|
exports.WeeklyLoadingView = WeeklyLoadingView;
|
|
20826
|
+
exports.WorkflowViewToggle = WorkflowViewToggle;
|
|
19460
20827
|
exports.YearView = YearView;
|
|
20828
|
+
exports.allRequiredSubtasksDone = allRequiredSubtasksDone;
|
|
20829
|
+
exports.anySubtaskStartedOrDone = anySubtaskStartedOrDone;
|
|
20830
|
+
exports.areDependenciesSatisfied = areDependenciesSatisfied;
|
|
19461
20831
|
exports.badgeVariants = badgeVariants;
|
|
19462
20832
|
exports.buttonGroupVariants = buttonGroupVariants;
|
|
19463
20833
|
exports.buttonVariants = buttonVariants;
|
|
@@ -19468,11 +20838,19 @@ exports.calculateDropDates = calculateDropDates;
|
|
|
19468
20838
|
exports.calculateFeasibility = calculateFeasibility;
|
|
19469
20839
|
exports.calculateMonthEventPositions = calculateMonthEventPositions;
|
|
19470
20840
|
exports.calculatePackagePositions = calculatePackagePositions;
|
|
20841
|
+
exports.calculateProgress = calculateProgress;
|
|
19471
20842
|
exports.canSubmitCalibration = canSubmitCalibration;
|
|
19472
20843
|
exports.cardVariants = cardVariants;
|
|
20844
|
+
exports.completeSubtask = completeSubtask;
|
|
20845
|
+
exports.computeAllPackageStates = computeAllPackageStates;
|
|
20846
|
+
exports.computePackageDerivedState = computePackageDerivedState;
|
|
20847
|
+
exports.computeSubtaskState = computeSubtaskState;
|
|
19473
20848
|
exports.createDefaultEvent = createDefaultEvent;
|
|
19474
20849
|
exports.deliveryIndicatorVariants = deliveryIndicatorVariants;
|
|
20850
|
+
exports.derivePackageBucket = derivePackageBucket;
|
|
20851
|
+
exports.derivePackageStatus = derivePackageStatus;
|
|
19475
20852
|
exports.extractPrefixes = extractPrefixes;
|
|
20853
|
+
exports.findNextActionableSubtask = findNextActionableSubtask;
|
|
19476
20854
|
exports.formatCalibrationUnit = formatCalibrationUnit;
|
|
19477
20855
|
exports.formatDateRange = formatDateRange2;
|
|
19478
20856
|
exports.formatDisplayDate = formatDisplayDate;
|
|
@@ -19485,8 +20863,11 @@ exports.generateColumns = generateColumns;
|
|
|
19485
20863
|
exports.generateEventId = generateEventId;
|
|
19486
20864
|
exports.generateLoadingWeek = generateLoadingWeek;
|
|
19487
20865
|
exports.generateLocationOptions = generateLocationOptions;
|
|
20866
|
+
exports.generateLockReason = generateLockReason;
|
|
20867
|
+
exports.generateNextActionLabel = generateNextActionLabel;
|
|
19488
20868
|
exports.generateWeekColumns = generateWeekColumns;
|
|
19489
20869
|
exports.generateWeeks = generateWeeks;
|
|
20870
|
+
exports.getBlockingSubtasks = getBlockingSubtasks;
|
|
19490
20871
|
exports.getCalendarCells = getCalendarCells;
|
|
19491
20872
|
exports.getCommentLocationLabel = getCommentLocationLabel;
|
|
19492
20873
|
exports.getCurrentEvents = getCurrentEvents;
|
|
@@ -19526,6 +20907,7 @@ exports.getYearMonths = getYearMonths;
|
|
|
19526
20907
|
exports.groupDeliveriesByDay = groupDeliveriesByDay;
|
|
19527
20908
|
exports.groupDeliveriesByPrefixAndDay = groupDeliveriesByPrefixAndDay;
|
|
19528
20909
|
exports.groupEvents = groupEvents;
|
|
20910
|
+
exports.groupPackagesByBucket = groupPackagesByBucket;
|
|
19529
20911
|
exports.isMultiDayEvent = isMultiDayEvent;
|
|
19530
20912
|
exports.isWorkingHour = isWorkingHour;
|
|
19531
20913
|
exports.navigateDate = navigateDate;
|
|
@@ -19538,8 +20920,10 @@ exports.sectionVariants = sectionVariants;
|
|
|
19538
20920
|
exports.snapToInterval = snapToInterval;
|
|
19539
20921
|
exports.sortEvents = sortEvents;
|
|
19540
20922
|
exports.splitEventsByDuration = splitEventsByDuration;
|
|
20923
|
+
exports.startSubtask = startSubtask;
|
|
19541
20924
|
exports.toggleVariants = toggleVariants;
|
|
19542
20925
|
exports.toolBarCanvasButtonVariants = toolBarCanvasButtonVariants;
|
|
20926
|
+
exports.updateSubtaskStatus = updateSubtaskStatus;
|
|
19543
20927
|
exports.useDrag = useDrag;
|
|
19544
20928
|
exports.useDraggable = useDraggable3;
|
|
19545
20929
|
exports.useDroppable = useDroppable;
|