Add personal dashboard flow and per-component website selection
This introduces a user-scoped dashboard with board-style view/edit pages while keeping it unavailable in team context, and moves website targeting to component config so dashboard components can each select their own website.
This commit is contained in:
1 parent
2633697585
commit
631cc46f7f
73 files changed
+418
-88
No files matched your search
@@ -13,6 +13,7 @@ export * from './context/useWebsite';
|
||||
export * from './queries/useActiveUsersQuery';
|
||||
export * from './queries/useBoardQuery';
|
||||
export * from './queries/useBoardsQuery';
|
||||
export * from './queries/useDashboardQuery';
|
||||
export * from './queries/useDateRangeQuery';
|
||||
export * from './queries/useDeleteQuery';
|
||||
export * from './queries/useEventDataEventsQuery';
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { keepPreviousData } from '@tanstack/react-query';
|
||||
import type { ReactQueryOptions } from '@/lib/types';
|
||||
import { useApi } from '../useApi';
|
||||
import { useModified } from '../useModified';
|
||||
|
||||
export function useDashboardQuery(options?: ReactQueryOptions) {
|
||||
const { get, useQuery } = useApi();
|
||||
const { modified } = useModified('dashboard');
|
||||
|
||||
return useQuery({
|
||||
queryKey: ['dashboard', { modified }],
|
||||
queryFn: () => get('/dashboard'),
|
||||
placeholderData: keepPreviousData,
|
||||
...options,
|
||||
});
|
||||
}
|
||||
@@ -24,7 +24,7 @@ export function WebsiteSelect({
|
||||
includeTeams?: boolean;
|
||||
isCollapsed?: boolean;
|
||||
} & SelectProps) {
|
||||
const { t, messages } = useMessages();
|
||||
const { t, labels, messages } = useMessages();
|
||||
const { data: website } = useWebsiteQuery(websiteId);
|
||||
const [name, setName] = useState<string>(website?.name);
|
||||
const [search, setSearch] = useState('');
|
||||
@@ -57,12 +57,16 @@ export function WebsiteSelect({
|
||||
return '';
|
||||
}
|
||||
|
||||
const value = name || props.placeholder || t(labels.selectWebsite);
|
||||
|
||||
return (
|
||||
<Row alignItems="center" gap>
|
||||
<Icon>
|
||||
<Globe />
|
||||
</Icon>
|
||||
<Text truncate>{name}</Text>
|
||||
<Text truncate color={name ? undefined : 'muted'}>
|
||||
{value}
|
||||
</Text>
|
||||
</Row>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -155,7 +155,6 @@ export const labels: Record<string, string> = {
|
||||
tablet: 'label.tablet',
|
||||
mobile: 'label.mobile',
|
||||
toggleCharts: 'label.toggle-charts',
|
||||
editDashboard: 'label.edit-dashboard',
|
||||
title: 'label.title',
|
||||
view: 'label.view',
|
||||
cities: 'label.cities',
|
||||
@@ -368,6 +367,7 @@ export const messages: Record<string, string> = {
|
||||
noResultsFound: 'message.no-results-found',
|
||||
noWebsitesConfigured: 'message.no-websites-configured',
|
||||
noTeamWebsites: 'message.no-team-websites',
|
||||
emptyDashboard: 'message.empty-dashboard',
|
||||
selectComponentPreview: 'message.select-component-preview',
|
||||
selectWebsiteFirst: 'message.select-website-first',
|
||||
teamWebsitesInfo: 'message.team-websites-info',
|
||||
|
||||
Reference in new issue
Block a user