From 67b38fe928a0e829b5595250399d04ea9c817c34 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Wed, 29 May 2024 16:41:16 +0800 Subject: [PATCH] Debug page to see scores --- .../web/lib/networking/queries/useGetHome.tsx | 2 + packages/web/pages/justread/debug.tsx | 89 +++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 packages/web/pages/justread/debug.tsx diff --git a/packages/web/lib/networking/queries/useGetHome.tsx b/packages/web/lib/networking/queries/useGetHome.tsx index 639cd08e5..86a8e521a 100644 --- a/packages/web/lib/networking/queries/useGetHome.tsx +++ b/packages/web/lib/networking/queries/useGetHome.tsx @@ -21,6 +21,7 @@ export type HomeItem = { date: string title: string url: string + score: number source: HomeItemSource previewContent?: string @@ -82,6 +83,7 @@ export function useGetHomeItems(): HomeItemResponse { id title url + score thumbnail previewContent saveCount diff --git a/packages/web/pages/justread/debug.tsx b/packages/web/pages/justread/debug.tsx new file mode 100644 index 000000000..bba6aae1f --- /dev/null +++ b/packages/web/pages/justread/debug.tsx @@ -0,0 +1,89 @@ +import { styled } from '@stitches/react' +import { AddToLibraryActionIcon } from '../../components/elements/icons/home/AddToLibraryActionIcon' +import { ArchiveActionIcon } from '../../components/elements/icons/home/ArchiveActionIcon' +import { CommentActionIcon } from '../../components/elements/icons/home/CommentActionIcon' +import { RemoveActionIcon } from '../../components/elements/icons/home/RemoveActionIcon' +import { ShareActionIcon } from '../../components/elements/icons/home/ShareActionIcon' +import { useApplyLocalTheme } from '../../lib/hooks/useApplyLocalTheme' +import { + HStack, + SpanBox, + VStack, +} from './../../components/elements/LayoutPrimitives' + +import * as HoverCard from '@radix-ui/react-hover-card' +import { Button } from '../../components/elements/Button' +import { + HomeItem, + HomeItemSource, + HomeItemSourceType, + HomeSection, + stubHomeItems, + useGetHomeItems, +} from '../../lib/networking/queries/useGetHome' +import { timeAgo } from '../../components/patterns/LibraryCards/LibraryCardStyles' +import { theme } from '../../components/tokens/stitches.config' +import { useRouter } from 'next/router' +import { + SubscriptionType, + useGetSubscriptionsQuery, +} from '../../lib/networking/queries/useGetSubscriptionsQuery' +import { useMemo } from 'react' + +export default function DebugHome(): JSX.Element { + const homeData = useGetHomeItems() + console.log('home sections: ', homeData.sections) + useApplyLocalTheme() + + return ( + + + {homeData.sections?.map((homeSection, idx) => { + return ( + + Section {idx} + Title: {homeSection.title} + Layout: {homeSection.layout} + Layout: {homeSection.thumbnail} + + {homeSection.items.map((homeItem) => { + return ( + + + {' '} + - Title:{' '} + {homeItem.title} + + - Score: {homeItem.score} + - Word count: {homeItem.wordCount} + - Date: {homeItem.date} + - + + ) + })} + + ) + })} + + + ) +}