Debug page to see scores

This commit is contained in:
Jackson Harper
2024-05-29 16:41:16 +08:00
parent 7466501c95
commit 67b38fe928
2 changed files with 91 additions and 0 deletions

View File

@ -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

View File

@ -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 (
<VStack
distribution="start"
alignment="center"
css={{
width: '100%',
bg: '$readerBg',
pt: '45px',
minHeight: '100vh',
}}
>
<VStack
distribution="start"
css={{
width: '646px',
gap: '40px',
minHeight: '100vh',
'@mdDown': {
width: '100%',
},
}}
>
{homeData.sections?.map((homeSection, idx) => {
return (
<VStack key={`homeSection-${idx}`} css={{ width: '100%' }}>
<SpanBox>Section {idx}</SpanBox>
<SpanBox>Title: {homeSection.title}</SpanBox>
<SpanBox>Layout: {homeSection.layout}</SpanBox>
<SpanBox>Layout: {homeSection.thumbnail}</SpanBox>
{homeSection.items.map((homeItem) => {
return (
<VStack key={homeItem.id}>
<SpanBox>
{' '}
- Title:{' '}
<a href={'/me/${homeItem.slug}'}>{homeItem.title}</a>
</SpanBox>
<SpanBox> - Score: {homeItem.score}</SpanBox>
<SpanBox> - Word count: {homeItem.wordCount}</SpanBox>
<SpanBox> - Date: {homeItem.date}</SpanBox>
<SpanBox> - </SpanBox>
</VStack>
)
})}
</VStack>
)
})}
</VStack>
</VStack>
)
}