feat: modernize widget experience

This commit is contained in:
Thomas Camlong committed 2026-08-03 17:18:22 +02:00
1 parent 65ff0ecb34
commit 61a2f8cb6c
198 files changed
+4209 -2295

No files matched your search

@@ -42,7 +42,7 @@ export const CustomWidgetRowActions = ({ widget }: { widget: WidgetRef }) => {
{
onSuccess: () => {
void utils.customWidget.all.invalidate();
void utils.widget.customApi.getData.invalidate({ definitionId: widget.id });
void utils.widget.customApi.getData.invalidate();
void revalidatePathActionAsync("/manage/custom-widgets");
},
onError: () => {
@@ -103,7 +103,7 @@ export const CustomWidgetRowActions = ({ widget }: { widget: WidgetRef }) => {
message: t("notification.deleted", { name: widget.name }),
});
void utils.customWidget.all.invalidate();
void utils.widget.customApi.getData.invalidate({ definitionId: widget.id });
void utils.widget.customApi.getData.invalidate();
void revalidatePathActionAsync("/manage/custom-widgets");
},
onError: () => {
@@ -611,7 +611,7 @@ export function CustomWidgetForm({ mode, initialValues, definitionId }: CustomWi
setPreviewRefreshSignal((n) => n + 1);
await utils.customWidget.all.invalidate();
await utils.customWidget.byId.invalidate({ id: definitionId });
await utils.widget.customApi.getData.invalidate({ definitionId });
await utils.widget.customApi.getData.invalidate();
}
} catch (err) {
const serverErrors = extractServerErrors(err, values.displayType);
@@ -657,7 +657,7 @@ export function CustomWidgetForm({ mode, initialValues, definitionId }: CustomWi
hasTestedRef.current = true;
setPreviewFetchResult({
success: res.success,
error: res.success ? undefined : res.error,
error: res.success ? undefined : t("notification.previewError"),
responseInfo: res.responseInfo,
rawResponse: res.rawResponse,
});
@@ -679,7 +679,7 @@ export function CustomWidgetForm({ mode, initialValues, definitionId }: CustomWi
});
setPreviewJson(null);
}
}, [getPreviewInput, previewMutation]);
}, [getPreviewInput, previewMutation, t]);
useEffect(() => {
if (previewRefreshSignal > 0 && hasTestedRef.current) {
@@ -816,7 +816,7 @@ export function CustomWidgetForm({ mode, initialValues, definitionId }: CustomWi
cachedJson={previewJson}
onTest={() => void handlePreviewTest()}
isTesting={previewMutation.isPending}
testError={previewMutation.error?.message ?? null}
testError={previewMutation.error ? t("notification.previewError") : null}
/>
</Box>
@@ -866,7 +866,7 @@ export function CustomWidgetForm({ mode, initialValues, definitionId }: CustomWi
cachedJson={previewJson}
onTest={() => void handlePreviewTest()}
isTesting={previewMutation.isPending}
testError={previewMutation.error?.message ?? null}
testError={previewMutation.error ? t("notification.previewError") : null}
/>
</Stack>
</Box>
@@ -24,7 +24,7 @@ interface PreviewInput {
export interface PreviewFetchResult {
success: boolean;
error?: string;
responseInfo: { status: number; statusText: string } | null;
responseInfo: { status: number } | null;
rawResponse: string | null;
}
@@ -93,7 +93,7 @@ export function CustomWidgetPreview({
</Text>
{fetchResult.responseInfo && (
<Badge size="xs" color="red" variant="light" mt={4}>
{fetchResult.responseInfo.status} {fetchResult.responseInfo.statusText}
{fetchResult.responseInfo.status}
</Badge>
)}
</Alert>
@@ -104,7 +104,7 @@ export function CustomWidgetPreview({
{fetchResult?.success && (
<Group gap="xs">
<Badge size="xs" color="green" variant="light">
{fetchResult.responseInfo?.status} {fetchResult.responseInfo?.statusText}
{fetchResult.responseInfo?.status}
</Badge>
</Group>
)}