Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zaknesler committed Dec 2, 2024
1 parent 8ebfe52 commit e82d5dd
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 21 deletions.
Binary file modified bun.lockb
Binary file not shown.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"@solid-primitives/scheduled": "^1.4.4",
"@solid-primitives/scroll": "^2.0.23",
"@solidjs/router": "^0.15.1",
"@tanstack/solid-query": "^5.61.5",
"@tanstack/solid-query-devtools": "^5.61.5",
"@tanstack/solid-query": "^5.62.0",
"@tanstack/solid-query-devtools": "^5.62.0",
"class-variance-authority": "^0.7.1",
"partysocket": "^1.0.2",
"solid-icons": "^1.1.0",
Expand All @@ -45,16 +45,16 @@
"@tailwindcss/forms": "^0.5.9",
"@tailwindcss/typography": "^0.5.15",
"@total-typescript/ts-reset": "^0.6.1",
"@vitest/coverage-v8": "^2.1.6",
"@vitest/coverage-v8": "^2.1.7",
"autoprefixer": "^10.4.20",
"jsdom": "^25.0.1",
"postcss": "^8.4.49",
"solid-devtools": "^0.30.1",
"tailwindcss": "^3.4.15",
"typescript": "^5.7.2",
"vite": "^6.0.1",
"vite": "^6.0.2",
"vite-plugin-solid": "^2.11.0",
"vite-tsconfig-paths": "^5.1.3",
"vitest": "^2.1.6"
"vitest": "^2.1.7"
}
}
3 changes: 2 additions & 1 deletion ui/src/components/nav/nav-view-tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import { Tabs } from '@kobalte/core/tabs';
import { useNavigate } from '@solidjs/router';
import { cx } from 'class-variance-authority';
import { For } from 'solid-js';
import { DEFAULTS } from '~/constants/query';
import { VIEWS, VIEW_LABELS } from '~/constants/views';
import { DEFAULTS, useQueryState } from '~/contexts/query-state-context';
import { useQueryState } from '~/contexts/query-state-context';
import type { View } from '~/types/bindings';
import { formatQueryString } from '~/utils/query';

Expand Down
15 changes: 15 additions & 0 deletions ui/src/constants/query.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { type FilterEntriesParams, SortDirection, View } from '~/types/bindings';

export const QUERY_KEYS = {
// Feeds
FEEDS: 'feeds.index',
Expand All @@ -22,3 +24,16 @@ export const QUERY_KEYS = {
FOLDERS: 'folders.index',
FOLDERS_CREATE: 'folders.create',
} as const;

export type RouterParams = {
entry_uuid?: string;
feed_uuid?: string;
folder_slug?: string;
};

export type QueryParams = Partial<Pick<FilterEntriesParams, 'view' | 'sort'>>;

export const DEFAULTS: Required<QueryParams> = {
view: View.Unread,
sort: SortDirection.Newest,
};
16 changes: 2 additions & 14 deletions ui/src/contexts/query-state-context.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useParams, useSearchParams } from '@solidjs/router';
import { createContext, useContext } from 'solid-js';
import { type FilterEntriesParams, SortDirection, View } from '~/types/bindings';
import { DEFAULTS, type QueryParams, type RouterParams } from '~/constants/query';
import type { SortDirection, View } from '~/types/bindings';
import { formatQueryString } from '~/utils/query';

type QueryStateContext = ReturnType<typeof makeQueryStateContext>;
Expand All @@ -12,19 +13,6 @@ export const useQueryState = () => {
return state;
};

type RouterParams = {
entry_uuid?: string;
feed_uuid?: string;
folder_slug?: string;
};

type QueryParams = Partial<Pick<FilterEntriesParams, 'view' | 'sort'>>;

export const DEFAULTS: Required<QueryParams> = {
view: View.Unread,
sort: SortDirection.Newest,
};

export const makeQueryStateContext = () => {
const params = useParams<RouterParams>();
const [query, setQuery] = useSearchParams<QueryParams>();
Expand Down
2 changes: 1 addition & 1 deletion ui/src/utils/entries/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IDS } from '~/constants/elements';
import { DEFAULTS } from '~/contexts/query-state-context';
import { DEFAULTS } from '~/constants/query';
import { type Entry, SortDirection, View } from '~/types/bindings';

/**
Expand Down

0 comments on commit e82d5dd

Please sign in to comment.