Skip to content

Commit

Permalink
feat: ui improve
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <[email protected]>
  • Loading branch information
Innei committed Jul 1, 2023
1 parent d2af6db commit ebd4ed1
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 27 deletions.
2 changes: 1 addition & 1 deletion next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ let nextConfig = {
sentryWebpackPlugin({
org: 'inneis-site',

project: 'Shiro',
project: 'springtide',
authToken: process.env.SENTRY_AUTH_TOKEN,
}),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { TimelineList } from '~/components/ui/list/TimelineList'
import { Loading } from '~/components/ui/loading'
import { BottomToUpSoftScaleTransitionView } from '~/components/ui/transition/BottomToUpSoftScaleTransitionView'
import { BottomToUpTransitionView } from '~/components/ui/transition/BottomToUpTransitionView'
import { LoadMoreIndicator } from '~/components/widgets/shared/LoadMoreIndicator'
import { routeBuilder, Routes } from '~/lib/route-builder'
import { apiClient } from '~/utils/request'

Expand All @@ -23,6 +24,7 @@ export default function Page() {
const {
data: notes,
isLoading,
hasNextPage,
fetchNextPage,
} = useInfiniteQuery({
queryKey: ['topicId', data?.id],
Expand Down Expand Up @@ -64,7 +66,6 @@ export default function Page() {
>
<Link
prefetch={false}
target="_blank"
href={routeBuilder(Routes.Note, {
id: child.nid,
})}
Expand All @@ -81,6 +82,8 @@ export default function Page() {
)
}),
)}

{hasNextPage && <LoadMoreIndicator onClick={fetchNextPage} />}
</TimelineList>
</main>
</BottomToUpSoftScaleTransitionView>
Expand Down
1 change: 0 additions & 1 deletion src/app/(note-topic)/notes/topics/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export default function Page() {
>
<Link
prefetch={false}
target="_blank"
href={routeBuilder(Routes.NoteTopic, {
slug: item.slug,
})}
Expand Down
3 changes: 1 addition & 2 deletions src/components/layout/header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { HeaderDataConfigureProvider } from './internal/HeaderDataConfigureProvi
import { HeaderDrawerButton } from './internal/HeaderDrawerButton'
import { HeaderMeta } from './internal/HeaderMeta'
import { HeaderWithShadow } from './internal/HeaderWithShadow'
import { SiteOwnerAvatar } from './internal/SiteOwnerAvatar'
import { UserAuth } from './internal/UserAuth'

export const Header = () => {
Expand All @@ -42,7 +41,7 @@ const MemoedHeader = memo(() => {

<HeaderLogoArea>
<AnimatedLogo />
<SiteOwnerAvatar className="absolute bottom-[10px] right-[2px] hidden lg:inline-block" />
{/* <SiteOwnerAvatar className="absolute bottom-[10px] right-[2px] hidden lg:inline-block" /> */}
<OnlyMobile>
<HeaderMeta />
</OnlyMobile>
Expand Down
11 changes: 8 additions & 3 deletions src/components/layout/header/internal/AnimatedLogo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Routes } from '~/lib/route-builder'
import { toast } from '~/lib/toast'

import { useHeaderMetaShouldShow } from './hooks'
import { Logo } from './Logo'
import { SiteOwnerAvatar } from './SiteOwnerAvatar'

const TapableLogo = () => {
const router = useRouter()
Expand All @@ -31,7 +31,12 @@ const TapableLogo = () => {
)
},
)
return <Logo onClick={fn} className="cursor-pointer" />
// return <Logo onClick={fn} className="cursor-pointer" />
return (
<button onClick={fn}>
<SiteOwnerAvatar className="cursor-pointer" />
</button>
)
}
export const AnimatedLogo = () => {
const shouldShowMeta = useHeaderMetaShouldShow()
Expand All @@ -47,7 +52,7 @@ export const AnimatedLogo = () => {
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
className="scale-75"
// className="scale-75"
>
<TapableLogo />
</m.div>
Expand Down
6 changes: 5 additions & 1 deletion src/components/layout/header/internal/HeaderArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ import styles from './grid.module.css'
export const HeaderLogoArea: Component = ({ children }) => {
return (
<div className={clsxm('relative', styles['header--grid__logo'])}>
<div className={clsxm('relative flex h-full w-full justify-center')}>
<div
className={clsxm(
'relative flex h-full w-full items-center justify-center',
)}
>
{children}
</div>
</div>
Expand Down
19 changes: 1 addition & 18 deletions src/components/widgets/comment/Comments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

import { useInfiniteQuery } from '@tanstack/react-query'
import { memo, useMemo } from 'react'
import { useInView } from 'react-intersection-observer'
import type { FC } from 'react'
import type { CommentBaseProps } from './types'

import { Loading } from '~/components/ui/loading'
import { BottomToUpSoftScaleTransitionView } from '~/components/ui/transition/BottomToUpSoftScaleTransitionView'
import { apiClient } from '~/utils/request'

import { LoadMoreIndicator } from '../shared/LoadMoreIndicator'
import { Comment } from './Comment'
import { CommentBoxProvider } from './CommentBox/providers'
import { CommentSkeleton } from './CommentSkeleton'
Expand Down Expand Up @@ -76,19 +75,3 @@ const CommentListItem: FC<{ comment: any; refId: string; index: number }> =
</BottomToUpSoftScaleTransitionView>
)
})

const LoadMoreIndicator: FC<{
onClick: () => void
}> = ({ onClick }) => {
const { ref } = useInView({
rootMargin: '1px',
onChange(inView) {
if (inView) onClick()
},
})
return (
<div ref={ref}>
<Loading />
</div>
)
}
22 changes: 22 additions & 0 deletions src/components/widgets/shared/LoadMoreIndicator.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use client'

import { useInView } from 'react-intersection-observer'
import type { FC } from 'react'

import { Loading } from '~/components/ui/loading'

export const LoadMoreIndicator: FC<{
onClick: () => void
}> = ({ onClick }) => {
const { ref } = useInView({
rootMargin: '1px',
onChange(inView) {
if (inView) onClick()
},
})
return (
<div ref={ref}>
<Loading />
</div>
)
}

1 comment on commit ebd4ed1

@vercel
Copy link

@vercel vercel bot commented on ebd4ed1 Jul 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

shiro – ./

springtide.vercel.app
shiro-innei.vercel.app
shiro-git-main-innei.vercel.app
innei.in

Please sign in to comment.