fix(review): address coderabbit review findings across modals, widgets, ui, and tests
This commit is contained in:
9 files changed
+24
-236
No files matched your search
@@ -52,7 +52,7 @@ export const AppSelectModal = createModal<AppSelectModalProps>(({ actions, inner
|
||||
const selectedApps = useMemo(() => apps.filter((app) => selectedAppIds.has(app.id)), [apps, selectedAppIds]);
|
||||
|
||||
const handleSelect = (app: SelectableApp, event?: React.MouseEvent) => {
|
||||
const isModifierPressed = Boolean(event?.shiftKey || event?.ctrlKey || event?.metaKey);
|
||||
const isModifierPressed = multiSelect && Boolean(event?.shiftKey || event?.ctrlKey || event?.metaKey);
|
||||
|
||||
if (innerProps.onSelect && !isModifierPressed && selectedAppIds.size === 0) {
|
||||
innerProps.onSelect(app);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
min-height: 175px;
|
||||
height: 100%;
|
||||
padding: var(--mantine-spacing-sm);
|
||||
border-radius: var(--mantine-radius-md);
|
||||
border-radius: var(--selectable-card-radius, var(--mantine-radius-md));
|
||||
background-color: light-dark(var(--mantine-color-white), var(--mantine-color-dark-7));
|
||||
border: 1px solid var(--mantine-color-default-border);
|
||||
box-shadow: var(--mantine-shadow-xs);
|
||||
|
||||
@@ -289,7 +289,7 @@ describe("SelectableCard", () => {
|
||||
});
|
||||
|
||||
describe("interactions and accessibility", () => {
|
||||
it("supports keyboard activation via Enter and Space", async () => {
|
||||
it("supports focus and click activation", async () => {
|
||||
const onClick = vi.fn();
|
||||
await act(async () =>
|
||||
root.render(
|
||||
@@ -304,7 +304,7 @@ describe("SelectableCard", () => {
|
||||
expect(document.activeElement).toBe(button);
|
||||
|
||||
await act(async () => {
|
||||
button?.dispatchEvent(new MouseEvent("click", { bubbles: true, cancelable: true }));
|
||||
button?.click();
|
||||
});
|
||||
expect(onClick).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
@@ -102,13 +102,13 @@ describe("IntegrationSelectGrid", () => {
|
||||
await act(async () =>
|
||||
root.render(
|
||||
<MantineProvider>
|
||||
<IntegrationSelectGrid onSelect={onSelect} allowedKinds={["homeAssistant"]} />
|
||||
<IntegrationSelectGrid onSelect={onSelect} allowedKinds={["google"]} />
|
||||
</MantineProvider>,
|
||||
),
|
||||
);
|
||||
|
||||
const homeAssistantCard = host.querySelector("button");
|
||||
expect(homeAssistantCard).not.toBeNull();
|
||||
expect(host.querySelector("button")).not.toBeNull();
|
||||
expect(host.textContent).toContain("No widgets tied to this service");
|
||||
});
|
||||
|
||||
it("displays '{count} connected' in footerLeft when integration instances exist", async () => {
|
||||
|
||||
@@ -139,9 +139,7 @@ const IntegrationCard = ({
|
||||
<Badge variant="light" color="teal" size="xs" radius="xs">
|
||||
{connectedCount} connected
|
||||
</Badge>
|
||||
) : (
|
||||
<IntegrationCategoryBadges categories={integration.categories} limit={1} />
|
||||
)
|
||||
) : null
|
||||
}
|
||||
>
|
||||
<Text size="10px" tt="uppercase" fw={700} c="dimmed">
|
||||
|
||||
@@ -50,6 +50,7 @@ export default function AppWidget({ options, isEditMode, height, width }: Widget
|
||||
[app, href, options.openInNewTab],
|
||||
);
|
||||
|
||||
if (!options.appId) return <WidgetEmptyState />;
|
||||
if (isInitialWidgetQueryPending(appQuery)) return <WidgetQueryLoadingState />;
|
||||
if (!app) return <WidgetEmptyState />;
|
||||
|
||||
|
||||
Reference in new issue
Block a user