Skip to content

Commit b170c22

Browse files
committed
review: More cleanup
1 parent 18d6334 commit b170c22

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

packages/app/src/components/AppNav/AppNav.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,10 @@ export default function AppNav({ fixed = false }: { fixed?: boolean }) {
665665
{!isCollapsed && (
666666
<Text size="xs" px="lg" py="xs" fw="lighter" fs="italic">
667667
Dashboards have moved! Try the{' '}
668-
<Link href="/dashboards">Dashboards page</Link>.
668+
<Anchor component={Link} href="/dashboards">
669+
Dashboards page
670+
</Anchor>
671+
.
669672
</Text>
670673
)}
671674

packages/app/src/components/Dashboards/DashboardListRow.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,23 @@ export function DashboardListRow({
1111
dashboard: Dashboard;
1212
onDelete: (id: string) => void;
1313
}) {
14+
const href = `/dashboards/${dashboard.id}`;
15+
1416
return (
1517
<Table.Tr
1618
style={{ cursor: 'pointer' }}
17-
onClick={() => Router.push(`/dashboards/${dashboard.id}`)}
19+
onClick={e => {
20+
if (e.metaKey || e.ctrlKey) {
21+
window.open(href, '_blank');
22+
} else {
23+
Router.push(href);
24+
}
25+
}}
26+
onAuxClick={e => {
27+
if (e.button === 1) {
28+
window.open(href, '_blank');
29+
}
30+
}}
1831
>
1932
<Table.Td>
2033
<Text fw={500} size="sm">

packages/app/src/components/Dashboards/DashboardsListPage.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { useQueryState } from 'nuqs';
66
import {
77
ActionIcon,
88
Button,
9-
Card,
109
Container,
1110
Flex,
1211
Group,
@@ -66,7 +65,7 @@ const PRESET_DASHBOARDS = [
6665

6766
export default function DashboardsListPage() {
6867
const brandName = useBrandDisplayName();
69-
const { data: dashboards, isLoading } = useDashboards();
68+
const { data: dashboards, isLoading, isError } = useDashboards();
7069
const confirm = useConfirm();
7170
const createDashboard = useCreateDashboard();
7271
const deleteDashboard = useDeleteDashboard();
@@ -108,6 +107,12 @@ export default function DashboardsListPage() {
108107
onSuccess: data => {
109108
Router.push(`/dashboards/${data.id}`);
110109
},
110+
onError: () => {
111+
notifications.show({
112+
message: 'Failed to create dashboard',
113+
color: 'red',
114+
});
115+
},
111116
},
112117
);
113118
}, [createDashboard]);
@@ -223,6 +228,10 @@ export default function DashboardsListPage() {
223228
<Text size="sm" c="dimmed" ta="center" py="xl">
224229
Loading dashboards...
225230
</Text>
231+
) : isError ? (
232+
<Text size="sm" c="red" ta="center" py="xl">
233+
Failed to load dashboards. Please try refreshing the page.
234+
</Text>
226235
) : filteredDashboards.length === 0 ? (
227236
<Stack align="center" gap="sm" py="xl">
228237
<IconLayoutGrid size={40} opacity={0.3} />

0 commit comments

Comments
 (0)