@tuturuuu/ui 0.7.0 → 0.9.0
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/CHANGELOG.md +88 -0
- package/biome.json +1 -1
- package/package.json +75 -73
- package/src/components/ui/accordion.tsx +1 -1
- package/src/components/ui/breadcrumb.tsx +1 -1
- package/src/components/ui/calendar-app/calendar-page-shell.tsx +4 -0
- package/src/components/ui/calendar-app/components/calendar-connections-settings-content.tsx +239 -33
- package/src/components/ui/calendar-app/components/load-smart-scheduling-tasks.tsx +143 -0
- package/src/components/ui/calendar-app/components/priority-view.tsx +10 -3
- package/src/components/ui/calendar-app/components/tasks-sidebar.tsx +4 -116
- package/src/components/ui/calendar-app/components/use-calendar-connections-manager.ts +67 -2
- package/src/components/ui/calendar.tsx +1 -1
- package/src/components/ui/carousel.tsx +1 -1
- package/src/components/ui/chat/chat-agent-details-external-thread-panel.test.tsx +1 -1
- package/src/components/ui/chat/chat-agent-details-external-thread-panel.tsx +1 -1
- package/src/components/ui/chat/chat-agent-details-operations-panel.test.tsx +1 -1
- package/src/components/ui/chat/chat-agent-details-operations-panel.tsx +1 -1
- package/src/components/ui/chat/chat-agent-details-setup-panel.tsx +1 -1
- package/src/components/ui/chat/chat-agent-details-sidebar.test.tsx +1 -1
- package/src/components/ui/chat/chat-agent-details-sidebar.tsx +2 -2
- package/src/components/ui/chat/chat-agent-details-utils.test.ts +1 -1
- package/src/components/ui/chat/chat-agent-details-utils.tsx +1 -1
- package/src/components/ui/chat/chat-agent-details-zalo-personal-panel.tsx +2 -2
- package/src/components/ui/checkbox.tsx +1 -1
- package/src/components/ui/color-picker.tsx +1 -1
- package/src/components/ui/command.tsx +1 -1
- package/src/components/ui/context-menu.tsx +5 -1
- package/src/components/ui/currency-input.test.tsx +43 -0
- package/src/components/ui/currency-input.tsx +1 -1
- package/src/components/ui/custom/__tests__/settings-dialog-shell.test.tsx +3 -0
- package/src/components/ui/custom/__tests__/workspace-select-helpers.test.ts +19 -0
- package/src/components/ui/custom/combobox.test.tsx +195 -0
- package/src/components/ui/custom/combobox.tsx +273 -156
- package/src/components/ui/custom/education/modules/youtube/delete-link-button.tsx +5 -13
- package/src/components/ui/custom/facebook-mockup/facebook-mockup.tsx +7 -1
- package/src/components/ui/custom/facebook-mockup/form.tsx +1 -1
- package/src/components/ui/custom/facebook-mockup/image-upload-field.tsx +1 -1
- package/src/components/ui/custom/facebook-mockup/preview.tsx +1 -1
- package/src/components/ui/custom/settings-dialog-shell.tsx +2 -1
- package/src/components/ui/custom/theme-toggle.tsx +1 -1
- package/src/components/ui/custom/workspace-access/workspace-access-default-role-card.tsx +60 -35
- package/src/components/ui/custom/workspace-access/workspace-access-member-row.tsx +176 -167
- package/src/components/ui/custom/workspace-access/workspace-access-members.tsx +16 -10
- package/src/components/ui/custom/workspace-access/workspace-access-page-header.tsx +75 -36
- package/src/components/ui/custom/workspace-access/workspace-access-page.tsx +39 -42
- package/src/components/ui/custom/workspace-access/workspace-access-people-filters.tsx +1 -1
- package/src/components/ui/custom/workspace-access/workspace-access-roles.tsx +113 -91
- package/src/components/ui/custom/workspace-access/workspace-access-tabs-toolbar.tsx +73 -32
- package/src/components/ui/custom/workspace-select.tsx +8 -3
- package/src/components/ui/dialog.test.tsx +52 -0
- package/src/components/ui/dialog.tsx +6 -2
- package/src/components/ui/dropdown-menu.tsx +5 -1
- package/src/components/ui/finance/debts/debt-loan-form.tsx +12 -5
- package/src/components/ui/finance/debts/debt-loan-summary.tsx +3 -2
- package/src/components/ui/finance/debts/debts-page.test.tsx +54 -5
- package/src/components/ui/finance/debts/debts-page.tsx +15 -2
- package/src/components/ui/finance/invoices/components/subscription-group-selector.tsx +3 -5
- package/src/components/ui/finance/invoices/new-invoice-page.test.tsx +25 -5
- package/src/components/ui/finance/invoices/new-invoice-page.tsx +7 -2
- package/src/components/ui/finance/invoices/standard-invoice.tsx +4 -2
- package/src/components/ui/finance/invoices/subscription-invoice.tsx +4 -2
- package/src/components/ui/finance/invoices/utils.ts +3 -1
- package/src/components/ui/finance/transactions/form-content-dialog.tsx +3 -0
- package/src/components/ui/finance/transactions/form-types.ts +3 -0
- package/src/components/ui/finance/transactions/form.tsx +2 -0
- package/src/components/ui/finance/transactions/infinite-transactions-list.tsx +2 -0
- package/src/components/ui/finance/transactions/period-charts/category-breakdown-dialog.tsx +1 -1
- package/src/components/ui/finance/transactions/transaction-card.tsx +21 -9
- package/src/components/ui/finance/transactions/transaction-edit-dialog.tsx +1 -4
- package/src/components/ui/finance/transactions/transactions-create-summary.tsx +3 -0
- package/src/components/ui/finance/transactions/transactions-page.tsx +4 -1
- package/src/components/ui/finance/wallets/form.test.tsx +51 -3
- package/src/components/ui/finance/wallets/form.tsx +15 -4
- package/src/components/ui/finance/wallets/walletId/wallet-details-actions.tsx +4 -0
- package/src/components/ui/finance/wallets/walletId/wallet-details-page.tsx +4 -2
- package/src/components/ui/finance/wallets/wallets-data-table.tsx +1 -0
- package/src/components/ui/finance/wallets/wallets-page.tsx +5 -2
- package/src/components/ui/input-otp.tsx +1 -1
- package/src/components/ui/legacy/calendar/all-day-event-bar.tsx +28 -39
- package/src/components/ui/legacy/calendar/calendar-cell.tsx +2 -0
- package/src/components/ui/legacy/calendar/calendar-content.tsx +10 -6
- package/src/components/ui/legacy/calendar/calendar-header.tsx +23 -3
- package/src/components/ui/legacy/calendar/calendar-loading-skeleton.tsx +135 -0
- package/src/components/ui/legacy/calendar/calendar-matrix.tsx +175 -237
- package/src/components/ui/legacy/calendar/event-card.test.tsx +177 -0
- package/src/components/ui/legacy/calendar/event-card.tsx +220 -131
- package/src/components/ui/legacy/calendar/event-modal.tsx +17 -17
- package/src/components/ui/legacy/calendar/event-provider-display.tsx +69 -0
- package/src/components/ui/legacy/calendar/smart-calendar.test.tsx +86 -4
- package/src/components/ui/legacy/calendar/smart-calendar.tsx +32 -2
- package/src/components/ui/legacy/meet/create-plan-dialog.tsx +19 -10
- package/src/components/ui/money-input.test.tsx +64 -0
- package/src/components/ui/money-input.tsx +63 -0
- package/src/components/ui/navigation-menu.tsx +1 -1
- package/src/components/ui/pagination.tsx +1 -1
- package/src/components/ui/radio-group.tsx +1 -1
- package/src/components/ui/select.tsx +5 -1
- package/src/components/ui/sheet.tsx +1 -1
- package/src/components/ui/sidebar.tsx +1 -1
- package/src/components/ui/storefront/cart-popover.tsx +61 -0
- package/src/components/ui/storefront/cart-summary-parts.tsx +290 -0
- package/src/components/ui/storefront/cart-summary.tsx +104 -80
- package/src/components/ui/storefront/checkout-overlay.tsx +26 -0
- package/src/components/ui/storefront/hero-panel.tsx +2 -8
- package/src/components/ui/storefront/image-panel.tsx +6 -0
- package/src/components/ui/storefront/index.ts +11 -0
- package/src/components/ui/storefront/listing-card.tsx +84 -22
- package/src/components/ui/storefront/merch-sections.tsx +70 -0
- package/src/components/ui/storefront/product-detail.tsx +289 -0
- package/src/components/ui/storefront/product-dialog.tsx +72 -0
- package/src/components/ui/storefront/storefront-surface.test.tsx +221 -3
- package/src/components/ui/storefront/storefront-surface.tsx +288 -153
- package/src/components/ui/storefront/types.ts +27 -1
- package/src/components/ui/storefront/utils.ts +117 -27
- package/src/components/ui/text-editor/__tests__/content-migration.test.ts +32 -0
- package/src/components/ui/text-editor/__tests__/extensions.test.ts +123 -0
- package/src/components/ui/text-editor/__tests__/image-extension.test.ts +69 -1
- package/src/components/ui/text-editor/__tests__/video-extension.test.ts +47 -0
- package/src/components/ui/text-editor/background-color-extension.ts +62 -0
- package/src/components/ui/text-editor/color-controls.tsx +284 -0
- package/src/components/ui/text-editor/content-migration.ts +41 -18
- package/src/components/ui/text-editor/editor.tsx +69 -14
- package/src/components/ui/text-editor/extensions.ts +9 -3
- package/src/components/ui/text-editor/highlight-extension.ts +22 -0
- package/src/components/ui/text-editor/image-extension.ts +40 -18
- package/src/components/ui/text-editor/tool-bar.tsx +9 -16
- package/src/components/ui/text-editor/video-extension.ts +11 -2
- package/src/components/ui/toast.tsx +1 -1
- package/src/components/ui/tu-do/boards/__tests__/board-share-dialog.test.tsx +270 -0
- package/src/components/ui/tu-do/boards/__tests__/workspace-projects-client-page.test.tsx +70 -1
- package/src/components/ui/tu-do/boards/board-public-link-section.tsx +231 -0
- package/src/components/ui/tu-do/boards/board-share-dialog.tsx +222 -109
- package/src/components/ui/tu-do/boards/boardId/board-column-external-retry.test.tsx +127 -0
- package/src/components/ui/tu-do/boards/boardId/board-column.tsx +113 -46
- package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-mutations-clear-delete.ts +2 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-mutations-move.ts +5 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/bulk/bulk-mutations-updates.ts +3 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/data/kanban-deadline-query.ts +50 -2
- package/src/components/ui/tu-do/boards/boardId/kanban/dnd/__tests__/column-reorder.test.ts +17 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/dnd/column-reorder.ts +4 -1
- package/src/components/ui/tu-do/boards/boardId/kanban/dnd/task-drag-cache.ts +51 -9
- package/src/components/ui/tu-do/boards/boardId/kanban/dnd/task-drag-order.ts +2 -8
- package/src/components/ui/tu-do/boards/boardId/kanban/dnd/task-sort-key.ts +47 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/dnd/use-kanban-dnd.test.ts +63 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/dnd/use-kanban-dnd.ts +127 -38
- package/src/components/ui/tu-do/boards/boardId/kanban/planner/__tests__/kanban-planner-island.test.tsx +380 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/planner/kanban-planner-dialog.tsx +204 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-digest-panel.tsx +61 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-item-strip.tsx +54 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-plan-toolbar.tsx +251 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-scope-badge.tsx +27 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-section.tsx +58 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-share-dialog.tsx +238 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-target-controls.tsx +143 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/planner/planner-utils.ts +65 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/planner/use-kanban-planner-state.ts +234 -0
- package/src/components/ui/tu-do/boards/boardId/kanban/rendering/kanban-columns.test.tsx +410 -4
- package/src/components/ui/tu-do/boards/boardId/kanban/rendering/kanban-columns.tsx +106 -14
- package/src/components/ui/tu-do/boards/boardId/kanban/rendering/kanban-deadline-panels.tsx +443 -19
- package/src/components/ui/tu-do/boards/boardId/kanban/rendering/kanban-skeleton.tsx +94 -32
- package/src/components/ui/tu-do/boards/boardId/kanban.tsx +213 -106
- package/src/components/ui/tu-do/boards/boardId/task-board-server-page.test.tsx +186 -0
- package/src/components/ui/tu-do/boards/boardId/task-board-server-page.tsx +59 -2
- package/src/components/ui/tu-do/boards/boardId/task-card/measured-task-card.tsx +3 -0
- package/src/components/ui/tu-do/boards/boardId/task-card/task-card-comparator.ts +3 -0
- package/src/components/ui/tu-do/boards/boardId/task-card/task-card.tsx +191 -28
- package/src/components/ui/tu-do/boards/boardId/task-filter.test.tsx +152 -0
- package/src/components/ui/tu-do/boards/boardId/task-filter.tsx +555 -545
- package/src/components/ui/tu-do/boards/boardId/task-list.tsx +7 -0
- package/src/components/ui/tu-do/boards/boardId/timeline/timeline-display.ts +9 -0
- package/src/components/ui/tu-do/boards/boardId/timeline/timeline-grid.tsx +8 -16
- package/src/components/ui/tu-do/boards/boardId/timeline/timeline-task-row.tsx +5 -25
- package/src/components/ui/tu-do/boards/boardId/timeline/timeline-utils.test.ts +36 -1
- package/src/components/ui/tu-do/boards/boardId/timeline/timeline-utils.ts +51 -2
- package/src/components/ui/tu-do/boards/share-section.tsx +100 -0
- package/src/components/ui/tu-do/boards/workspace-projects-client-page.tsx +13 -3
- package/src/components/ui/tu-do/drafts/draft-convert-dialog.tsx +10 -12
- package/src/components/ui/tu-do/drafts/drafts-page.tsx +33 -16
- package/src/components/ui/tu-do/initiatives/task-initiatives-client.tsx +56 -88
- package/src/components/ui/tu-do/my-tasks/my-tasks-content.tsx +26 -2
- package/src/components/ui/tu-do/my-tasks/use-my-tasks-state.ts +55 -8
- package/src/components/ui/tu-do/notes/note-edit-dialog.tsx +1 -4
- package/src/components/ui/tu-do/shared/__tests__/board-client.test.tsx +25 -0
- package/src/components/ui/tu-do/shared/__tests__/board-header.test.tsx +341 -38
- package/src/components/ui/tu-do/shared/__tests__/board-switcher.test.tsx +253 -0
- package/src/components/ui/tu-do/shared/__tests__/board-views.test.tsx +237 -3
- package/src/components/ui/tu-do/shared/__tests__/task-board-loading-state.test.tsx +17 -0
- package/src/components/ui/tu-do/shared/__tests__/task-legacy-route-recovery.test.tsx +16 -0
- package/src/components/ui/tu-do/shared/board-client.tsx +2 -7
- package/src/components/ui/tu-do/shared/board-config-storage.ts +7 -1
- package/src/components/ui/tu-do/shared/board-header.tsx +465 -937
- package/src/components/ui/tu-do/shared/board-layout-settings.tsx +165 -136
- package/src/components/ui/tu-do/shared/board-switcher.tsx +209 -217
- package/src/components/ui/tu-do/shared/board-views.tsx +596 -82
- package/src/components/ui/tu-do/shared/cursor-overlay-multi-wrapper.tsx +53 -12
- package/src/components/ui/tu-do/shared/list-view.tsx +227 -1
- package/src/components/ui/tu-do/shared/recycle-bin-panel.tsx +142 -94
- package/src/components/ui/tu-do/shared/special-task-list-pins.ts +51 -0
- package/src/components/ui/tu-do/shared/task-board-loading-state.tsx +28 -0
- package/src/components/ui/tu-do/shared/task-dialog-presentation.test.ts +53 -0
- package/src/components/ui/tu-do/shared/task-dialog-presentation.ts +19 -0
- package/src/components/ui/tu-do/shared/task-edit-dialog/components/compact-task-create-popover.test.tsx +57 -0
- package/src/components/ui/tu-do/shared/task-edit-dialog/components/compact-task-create-popover.tsx +136 -111
- package/src/components/ui/tu-do/shared/task-edit-dialog/components/task-description-editor.tsx +3 -1
- package/src/components/ui/tu-do/shared/task-edit-dialog/field-diff-viewer.tsx +3 -2
- package/src/components/ui/tu-do/shared/task-edit-dialog/selective-revert-panel.test.tsx +91 -0
- package/src/components/ui/tu-do/shared/task-edit-dialog/selective-revert-panel.tsx +123 -78
- package/src/components/ui/tu-do/shared/task-edit-dialog/task-activity-section.tsx +7 -1
- package/src/components/ui/tu-do/shared/task-edit-dialog/task-snapshot-dialog.tsx +8 -3
- package/src/components/ui/tu-do/shared/task-edit-dialog.tsx +44 -15
- package/src/components/ui/tu-do/shared/task-legacy-route-recovery.tsx +2 -9
- package/src/declarations.d.ts +1 -0
- package/src/hooks/__tests__/use-calendar-readonly.test.tsx +322 -2
- package/src/hooks/__tests__/use-calendar-sync.test.tsx +446 -0
- package/src/hooks/__tests__/useBoardRealtime.test.tsx +2 -2
- package/src/hooks/__tests__/useCursorTracking.test.tsx +212 -0
- package/src/hooks/use-calendar-sync.tsx +247 -243
- package/src/hooks/use-calendar.tsx +323 -138
- package/src/hooks/use-task-actions.ts +24 -0
- package/src/hooks/use-user-workspace-config.ts +75 -0
- package/src/hooks/use-workspace-currency.ts +8 -3
- package/src/hooks/useBoardRealtime.ts +6 -3
- package/src/hooks/useBoardRealtime.types.ts +11 -0
- package/src/hooks/useBoardRealtimeEventHandler.ts +11 -0
- package/src/hooks/useCursorTracking.ts +91 -27
- package/src/hooks/useTaskUserRealtime.ts +5 -3
|
@@ -7,8 +7,42 @@ import { describe, expect, it, vi } from 'vitest';
|
|
|
7
7
|
import { SmartCalendar } from './smart-calendar';
|
|
8
8
|
|
|
9
9
|
vi.mock('@tuturuuu/ui/hooks/use-calendar', () => ({
|
|
10
|
-
CalendarProvider: ({
|
|
11
|
-
|
|
10
|
+
CalendarProvider: ({
|
|
11
|
+
children,
|
|
12
|
+
eventAdapter,
|
|
13
|
+
}: {
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
eventAdapter?: {
|
|
16
|
+
disableBuiltInEventUi?: boolean;
|
|
17
|
+
preservePastEventOpacity?: boolean;
|
|
18
|
+
};
|
|
19
|
+
}) => (
|
|
20
|
+
<div
|
|
21
|
+
data-adapter={eventAdapter ? 'true' : 'false'}
|
|
22
|
+
data-preserve-past-opacity={
|
|
23
|
+
eventAdapter?.preservePastEventOpacity ? 'true' : 'false'
|
|
24
|
+
}
|
|
25
|
+
data-testid="calendar-provider"
|
|
26
|
+
>
|
|
27
|
+
{children}
|
|
28
|
+
</div>
|
|
29
|
+
),
|
|
30
|
+
}));
|
|
31
|
+
|
|
32
|
+
vi.mock('@tuturuuu/ui/hooks/use-calendar-sync', () => ({
|
|
33
|
+
CalendarSyncProvider: ({
|
|
34
|
+
children,
|
|
35
|
+
externalEvents,
|
|
36
|
+
}: {
|
|
37
|
+
children: ReactNode;
|
|
38
|
+
externalEvents?: unknown[];
|
|
39
|
+
}) => (
|
|
40
|
+
<div
|
|
41
|
+
data-external-events={externalEvents?.length ?? 0}
|
|
42
|
+
data-testid="calendar-sync-provider"
|
|
43
|
+
>
|
|
44
|
+
{children}
|
|
45
|
+
</div>
|
|
12
46
|
),
|
|
13
47
|
}));
|
|
14
48
|
|
|
@@ -19,8 +53,17 @@ vi.mock('./settings/settings-context', () => ({
|
|
|
19
53
|
}));
|
|
20
54
|
|
|
21
55
|
vi.mock('./calendar-content', () => ({
|
|
22
|
-
CalendarContent: ({
|
|
23
|
-
|
|
56
|
+
CalendarContent: ({
|
|
57
|
+
disableBuiltInEventUi,
|
|
58
|
+
extras,
|
|
59
|
+
}: {
|
|
60
|
+
disableBuiltInEventUi?: boolean;
|
|
61
|
+
extras?: ReactNode;
|
|
62
|
+
}) => (
|
|
63
|
+
<div
|
|
64
|
+
data-disable-built-in-ui={disableBuiltInEventUi ? 'true' : 'false'}
|
|
65
|
+
data-testid="calendar-content"
|
|
66
|
+
>
|
|
24
67
|
<div data-testid="header-extras">{extras}</div>
|
|
25
68
|
</div>
|
|
26
69
|
),
|
|
@@ -73,4 +116,43 @@ describe('SmartCalendar', () => {
|
|
|
73
116
|
expect(screen.queryByTestId('connections-manager')).toBeNull();
|
|
74
117
|
expect(screen.getByTestId('custom-extra').textContent).toBe('extra');
|
|
75
118
|
});
|
|
119
|
+
|
|
120
|
+
it('passes custom event adapters and external events through the calendar shell', () => {
|
|
121
|
+
render(
|
|
122
|
+
<SmartCalendar
|
|
123
|
+
{...baseProps}
|
|
124
|
+
workspace={{ id: 'workspace-1' } as Workspace}
|
|
125
|
+
showConnectionsManager={false}
|
|
126
|
+
eventAdapter={{
|
|
127
|
+
disableBuiltInEventUi: true,
|
|
128
|
+
preservePastEventOpacity: true,
|
|
129
|
+
}}
|
|
130
|
+
externalEvents={[
|
|
131
|
+
{
|
|
132
|
+
id: 'session-1',
|
|
133
|
+
title: 'Class',
|
|
134
|
+
start_at: '2026-06-19T12:00:00.000Z',
|
|
135
|
+
end_at: '2026-06-19T13:00:00.000Z',
|
|
136
|
+
},
|
|
137
|
+
]}
|
|
138
|
+
/>
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
expect(screen.getByTestId('calendar-sync-provider')).toHaveAttribute(
|
|
142
|
+
'data-external-events',
|
|
143
|
+
'1'
|
|
144
|
+
);
|
|
145
|
+
expect(screen.getByTestId('calendar-provider')).toHaveAttribute(
|
|
146
|
+
'data-adapter',
|
|
147
|
+
'true'
|
|
148
|
+
);
|
|
149
|
+
expect(screen.getByTestId('calendar-provider')).toHaveAttribute(
|
|
150
|
+
'data-preserve-past-opacity',
|
|
151
|
+
'true'
|
|
152
|
+
);
|
|
153
|
+
expect(screen.getByTestId('calendar-content')).toHaveAttribute(
|
|
154
|
+
'data-disable-built-in-ui',
|
|
155
|
+
'true'
|
|
156
|
+
);
|
|
157
|
+
});
|
|
76
158
|
});
|
|
@@ -4,7 +4,12 @@ import type {
|
|
|
4
4
|
Workspace,
|
|
5
5
|
WorkspaceCalendarGoogleTokenClient,
|
|
6
6
|
} from '@tuturuuu/types';
|
|
7
|
-
import {
|
|
7
|
+
import type { CalendarEvent } from '@tuturuuu/types/primitives/calendar-event';
|
|
8
|
+
import {
|
|
9
|
+
type CalendarEventAdapter,
|
|
10
|
+
CalendarProvider,
|
|
11
|
+
} from '@tuturuuu/ui/hooks/use-calendar';
|
|
12
|
+
import { CalendarSyncProvider } from '@tuturuuu/ui/hooks/use-calendar-sync';
|
|
8
13
|
import type { CalendarView } from '../../../../hooks/use-view-transition';
|
|
9
14
|
import CalendarConnectionsUnified from '../../calendar-app/components/calendar-connections-unified';
|
|
10
15
|
import { CalendarContent } from './calendar-content';
|
|
@@ -28,6 +33,10 @@ export const SmartCalendar = ({
|
|
|
28
33
|
initialSettings,
|
|
29
34
|
onSaveSettings,
|
|
30
35
|
showConnectionsManager = true,
|
|
36
|
+
eventAdapter,
|
|
37
|
+
externalEvents,
|
|
38
|
+
externalEventsLoading,
|
|
39
|
+
externalEventsRefresh,
|
|
31
40
|
}: {
|
|
32
41
|
t: any;
|
|
33
42
|
locale: string;
|
|
@@ -49,6 +58,10 @@ export const SmartCalendar = ({
|
|
|
49
58
|
initialSettings?: Partial<CalendarSettings>;
|
|
50
59
|
onSaveSettings?: (settings: CalendarSettings) => Promise<void>;
|
|
51
60
|
showConnectionsManager?: boolean;
|
|
61
|
+
eventAdapter?: CalendarEventAdapter;
|
|
62
|
+
externalEvents?: CalendarEvent[];
|
|
63
|
+
externalEventsLoading?: boolean;
|
|
64
|
+
externalEventsRefresh?: () => void;
|
|
52
65
|
}) => {
|
|
53
66
|
const handleSaveSettings = async (newSettings: CalendarSettings) => {
|
|
54
67
|
if (onSaveSettings) {
|
|
@@ -65,12 +78,13 @@ export const SmartCalendar = ({
|
|
|
65
78
|
extras
|
|
66
79
|
);
|
|
67
80
|
|
|
68
|
-
|
|
81
|
+
const calendar = (
|
|
69
82
|
<CalendarProvider
|
|
70
83
|
ws={workspace}
|
|
71
84
|
useQuery={useQuery}
|
|
72
85
|
useQueryClient={useQueryClient}
|
|
73
86
|
experimentalGoogleToken={experimentalGoogleToken}
|
|
87
|
+
eventAdapter={eventAdapter}
|
|
74
88
|
readOnly={disabled}
|
|
75
89
|
>
|
|
76
90
|
<CalendarSettingsProvider
|
|
@@ -87,8 +101,24 @@ export const SmartCalendar = ({
|
|
|
87
101
|
externalState={externalState}
|
|
88
102
|
extras={headerExtras}
|
|
89
103
|
overlay={overlay}
|
|
104
|
+
disableBuiltInEventUi={eventAdapter?.disableBuiltInEventUi}
|
|
90
105
|
/>
|
|
91
106
|
</CalendarSettingsProvider>
|
|
92
107
|
</CalendarProvider>
|
|
93
108
|
);
|
|
109
|
+
|
|
110
|
+
if (externalEvents) {
|
|
111
|
+
return (
|
|
112
|
+
<CalendarSyncProvider
|
|
113
|
+
wsId={workspace?.id ?? 'external'}
|
|
114
|
+
externalEvents={externalEvents}
|
|
115
|
+
externalEventsLoading={externalEventsLoading}
|
|
116
|
+
externalRefresh={externalEventsRefresh}
|
|
117
|
+
>
|
|
118
|
+
{calendar}
|
|
119
|
+
</CalendarSyncProvider>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return calendar;
|
|
94
124
|
};
|
|
@@ -32,14 +32,19 @@ import { toast } from '@tuturuuu/ui/hooks/use-toast';
|
|
|
32
32
|
import { Input } from '@tuturuuu/ui/input';
|
|
33
33
|
import { zodResolver } from '@tuturuuu/ui/resolvers';
|
|
34
34
|
import { Separator } from '@tuturuuu/ui/separator';
|
|
35
|
-
import { RichTextEditor } from '@tuturuuu/ui/text-editor/editor';
|
|
36
35
|
import { cn } from '@tuturuuu/utils/format';
|
|
37
36
|
import dayjs from 'dayjs';
|
|
38
37
|
import { useRouter } from 'next/navigation';
|
|
39
38
|
import { useTranslations } from 'next-intl';
|
|
40
|
-
import { useState } from 'react';
|
|
39
|
+
import { lazy, Suspense, useState } from 'react';
|
|
41
40
|
import * as z from 'zod';
|
|
42
41
|
|
|
42
|
+
const RichTextEditor = lazy(async () => {
|
|
43
|
+
const module = await import('@tuturuuu/ui/text-editor/editor');
|
|
44
|
+
|
|
45
|
+
return { default: module.RichTextEditor };
|
|
46
|
+
});
|
|
47
|
+
|
|
43
48
|
interface Props {
|
|
44
49
|
user: Partial<User> | null;
|
|
45
50
|
plan: {
|
|
@@ -369,14 +374,18 @@ export default function CreatePlanDialog({ plan }: Props) {
|
|
|
369
374
|
<FormItem>
|
|
370
375
|
<FormControl>
|
|
371
376
|
<div className="rounded-lg border border-dynamic-green/30 bg-dynamic-green/5 p-3">
|
|
372
|
-
<
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
377
|
+
<Suspense fallback={<div className="h-64" />}>
|
|
378
|
+
<RichTextEditor
|
|
379
|
+
content={field.value || null}
|
|
380
|
+
onChange={field.onChange}
|
|
381
|
+
readOnly={false}
|
|
382
|
+
titlePlaceholder={t('agenda_title_placeholder')}
|
|
383
|
+
writePlaceholder={t(
|
|
384
|
+
'agenda_content_placeholder'
|
|
385
|
+
)}
|
|
386
|
+
className="h-64 border-0 bg-transparent"
|
|
387
|
+
/>
|
|
388
|
+
</Suspense>
|
|
380
389
|
</div>
|
|
381
390
|
</FormControl>
|
|
382
391
|
<FormMessage />
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { fireEvent, render, screen } from '@testing-library/react';
|
|
2
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
3
|
+
import { MoneyInput } from './money-input';
|
|
4
|
+
|
|
5
|
+
describe('MoneyInput', () => {
|
|
6
|
+
it('renders a minor-unit USD value as major units', () => {
|
|
7
|
+
render(
|
|
8
|
+
<MoneyInput
|
|
9
|
+
aria-label="Price"
|
|
10
|
+
currency="USD"
|
|
11
|
+
hideHelpers
|
|
12
|
+
onChange={vi.fn()}
|
|
13
|
+
value={10000}
|
|
14
|
+
/>
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
const input = screen.getByLabelText('Price') as HTMLInputElement;
|
|
18
|
+
expect(input).toHaveValue('100');
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('emits minor units (cents) for a USD entry', () => {
|
|
22
|
+
const onChange = vi.fn();
|
|
23
|
+
render(
|
|
24
|
+
<MoneyInput
|
|
25
|
+
aria-label="Price"
|
|
26
|
+
currency="USD"
|
|
27
|
+
hideHelpers
|
|
28
|
+
onChange={onChange}
|
|
29
|
+
value={undefined}
|
|
30
|
+
/>
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
const input = screen.getByLabelText('Price') as HTMLInputElement;
|
|
34
|
+
fireEvent.focus(input);
|
|
35
|
+
fireEvent.change(input, {
|
|
36
|
+
target: { selectionStart: 4, value: '9.99' },
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
expect(onChange).toHaveBeenLastCalledWith(999);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('treats zero-decimal currencies 1:1', () => {
|
|
43
|
+
const onChange = vi.fn();
|
|
44
|
+
render(
|
|
45
|
+
<MoneyInput
|
|
46
|
+
aria-label="Price"
|
|
47
|
+
currency="VND"
|
|
48
|
+
hideHelpers
|
|
49
|
+
onChange={onChange}
|
|
50
|
+
value={25000}
|
|
51
|
+
/>
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
const input = screen.getByLabelText('Price') as HTMLInputElement;
|
|
55
|
+
// 25000 minor units == 25000 major units for VND (0 fraction digits).
|
|
56
|
+
expect(input.value.replace(/[^\d]/g, '')).toBe('25000');
|
|
57
|
+
|
|
58
|
+
fireEvent.focus(input);
|
|
59
|
+
fireEvent.change(input, {
|
|
60
|
+
target: { selectionStart: 3, value: '500' },
|
|
61
|
+
});
|
|
62
|
+
expect(onChange).toHaveBeenLastCalledWith(500);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { getCurrencyLocale } from '@tuturuuu/utils/format';
|
|
4
|
+
import {
|
|
5
|
+
getCurrencyFractionDigits,
|
|
6
|
+
majorToMinor,
|
|
7
|
+
minorToMajor,
|
|
8
|
+
} from '@tuturuuu/utils/money';
|
|
9
|
+
import { useMemo } from 'react';
|
|
10
|
+
import { CurrencyInput, type CurrencyInputProps } from './currency-input';
|
|
11
|
+
|
|
12
|
+
export interface MoneyInputProps
|
|
13
|
+
extends Omit<
|
|
14
|
+
CurrencyInputProps,
|
|
15
|
+
'value' | 'onChange' | 'locale' | 'maximumFractionDigits' | 'currencySuffix'
|
|
16
|
+
> {
|
|
17
|
+
/** ISO currency code (e.g. 'USD', 'VND'). Drives precision + locale. */
|
|
18
|
+
currency: string;
|
|
19
|
+
/** Amount in integer minor units (cents for USD, whole units for JPY/VND). */
|
|
20
|
+
value: number | undefined;
|
|
21
|
+
/** Emits the amount in integer minor units. */
|
|
22
|
+
onChange: (minorValue: number) => void;
|
|
23
|
+
/** Show the currency code as a muted suffix (defaults to true). */
|
|
24
|
+
showCurrencySuffix?: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Currency-aware money input. The `value`/`onChange` boundary is always in
|
|
29
|
+
* integer **minor units** (the canonical storage format); the field renders and
|
|
30
|
+
* edits in localized major units with the correct precision for the currency.
|
|
31
|
+
*
|
|
32
|
+
* Wraps the shared {@link CurrencyInput} so all money entry across the platform
|
|
33
|
+
* shares one polished input (cursor preservation, quick-action helpers) while
|
|
34
|
+
* keeping the minor-unit conversion centralized in one place.
|
|
35
|
+
*/
|
|
36
|
+
export function MoneyInput({
|
|
37
|
+
currency,
|
|
38
|
+
value,
|
|
39
|
+
onChange,
|
|
40
|
+
showCurrencySuffix = true,
|
|
41
|
+
...props
|
|
42
|
+
}: MoneyInputProps) {
|
|
43
|
+
const fractionDigits = useMemo(
|
|
44
|
+
() => getCurrencyFractionDigits(currency),
|
|
45
|
+
[currency]
|
|
46
|
+
);
|
|
47
|
+
const locale = useMemo(() => getCurrencyLocale(currency), [currency]);
|
|
48
|
+
const majorValue = useMemo(
|
|
49
|
+
() => (value === undefined ? undefined : minorToMajor(value, currency)),
|
|
50
|
+
[currency, value]
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<CurrencyInput
|
|
55
|
+
{...props}
|
|
56
|
+
value={majorValue}
|
|
57
|
+
onChange={(major) => onChange(majorToMinor(major, currency))}
|
|
58
|
+
locale={locale}
|
|
59
|
+
maximumFractionDigits={fractionDigits}
|
|
60
|
+
currencySuffix={showCurrencySuffix ? currency.toUpperCase() : undefined}
|
|
61
|
+
/>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import * as NavigationMenuPrimitive from '@radix-ui/react-navigation-menu';
|
|
4
|
-
import { ChevronDownIcon } from '@tuturuuu/icons';
|
|
4
|
+
import { ChevronDownIcon } from '@tuturuuu/icons/lucide-static';
|
|
5
5
|
import { cn } from '@tuturuuu/utils/format';
|
|
6
6
|
import { cva } from 'class-variance-authority';
|
|
7
7
|
import type * as React from 'react';
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
ChevronLeftIcon,
|
|
3
3
|
ChevronRightIcon,
|
|
4
4
|
MoreHorizontalIcon,
|
|
5
|
-
} from '@tuturuuu/icons';
|
|
5
|
+
} from '@tuturuuu/icons/lucide-static';
|
|
6
6
|
import { cn } from '@tuturuuu/utils/format';
|
|
7
7
|
import type * as React from 'react';
|
|
8
8
|
import { type Button, buttonVariants } from './button';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
4
|
-
import { CircleIcon } from '@tuturuuu/icons';
|
|
4
|
+
import { CircleIcon } from '@tuturuuu/icons/lucide-static';
|
|
5
5
|
import { cn } from '@tuturuuu/utils/format';
|
|
6
6
|
import type * as React from 'react';
|
|
7
7
|
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
CheckIcon,
|
|
6
|
+
ChevronDownIcon,
|
|
7
|
+
ChevronUpIcon,
|
|
8
|
+
} from '@tuturuuu/icons/lucide-static';
|
|
5
9
|
import { cn } from '@tuturuuu/utils/format';
|
|
6
10
|
import type * as React from 'react';
|
|
7
11
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { Slot } from '@radix-ui/react-slot';
|
|
4
|
-
import { PanelLeftIcon } from '@tuturuuu/icons';
|
|
4
|
+
import { PanelLeftIcon } from '@tuturuuu/icons/lucide-static';
|
|
5
5
|
import { cn } from '@tuturuuu/utils/format';
|
|
6
6
|
import { cva, type VariantProps } from 'class-variance-authority';
|
|
7
7
|
import * as React from 'react';
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { ShoppingCart } from '@tuturuuu/icons';
|
|
4
|
+
import { cn } from '@tuturuuu/utils/format';
|
|
5
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
6
|
+
import { Popover, PopoverContent, PopoverTrigger } from '../popover';
|
|
7
|
+
import type { StorefrontSurfaceLabels } from './types';
|
|
8
|
+
|
|
9
|
+
export function StorefrontCartPopover({
|
|
10
|
+
cartQuantity,
|
|
11
|
+
children,
|
|
12
|
+
labels,
|
|
13
|
+
onOpenChange,
|
|
14
|
+
open,
|
|
15
|
+
radius,
|
|
16
|
+
}: {
|
|
17
|
+
cartQuantity: number;
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
labels: StorefrontSurfaceLabels;
|
|
20
|
+
onOpenChange: (open: boolean) => void;
|
|
21
|
+
open: boolean;
|
|
22
|
+
radius: string;
|
|
23
|
+
}) {
|
|
24
|
+
const cartControlStyle: CSSProperties | undefined =
|
|
25
|
+
cartQuantity > 0
|
|
26
|
+
? {
|
|
27
|
+
borderColor: 'var(--storefront-accent-border, var(--border))',
|
|
28
|
+
color: 'var(--storefront-accent-text, var(--primary))',
|
|
29
|
+
}
|
|
30
|
+
: undefined;
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<Popover onOpenChange={onOpenChange} open={open}>
|
|
34
|
+
<PopoverTrigger asChild>
|
|
35
|
+
<button
|
|
36
|
+
aria-label={`${labels.cart}: ${cartQuantity}`}
|
|
37
|
+
className={cn(
|
|
38
|
+
'inline-flex h-11 min-w-14 shrink-0 items-center justify-center gap-2 border bg-card px-3 font-semibold text-sm tabular-nums transition hover:bg-muted/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40',
|
|
39
|
+
radius
|
|
40
|
+
)}
|
|
41
|
+
style={cartControlStyle}
|
|
42
|
+
type="button"
|
|
43
|
+
>
|
|
44
|
+
<ShoppingCart aria-hidden className="size-5 shrink-0" />
|
|
45
|
+
<span className="sr-only">{labels.cart}: </span>
|
|
46
|
+
<span className="min-w-4 text-center">{cartQuantity}</span>
|
|
47
|
+
</button>
|
|
48
|
+
</PopoverTrigger>
|
|
49
|
+
<PopoverContent
|
|
50
|
+
align="end"
|
|
51
|
+
className={cn(
|
|
52
|
+
'w-[min(calc(100vw-2rem),24rem)] border-border/70 p-4 shadow-xl',
|
|
53
|
+
radius
|
|
54
|
+
)}
|
|
55
|
+
sideOffset={10}
|
|
56
|
+
>
|
|
57
|
+
{children}
|
|
58
|
+
</PopoverContent>
|
|
59
|
+
</Popover>
|
|
60
|
+
);
|
|
61
|
+
}
|