Skip to content

Commit

Permalink
fix: fix eslint error
Browse files Browse the repository at this point in the history
  • Loading branch information
xinyao27 committed Jul 5, 2023
1 parent baa6c93 commit 9ae5eb8
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 21 deletions.
44 changes: 25 additions & 19 deletions packages/web/app/[locale]/[projectId]/profile/profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,25 @@ interface Props {
const View = ({ views }: Props) => {
const t = useTranslations('Profile')
const pageViewTrend = useMemo(
() => views.pageViewLastDay > 0
? ((views.pageView - views.pageViewLastDay) / views.pageViewLastDay * 100).toFixed(2)
: 100,
[views.pageView, views.pageViewLastDay],
() => {
if (!views) return 100
return views.pageViewLastDay > 0
? ((views.pageView - views.pageViewLastDay) / views.pageViewLastDay * 100).toFixed(2)
: 100
},
[views?.pageView, views?.pageViewLastDay],
)
const userViewTrend = useMemo(
() => views.pageViewLastDay > 0
? ((views.userView - views.userViewLastDay) / views.userViewLastDay * 100).toFixed(2)
: 100,
[views.userView, views.userViewLastDay],
() => {
if (!views) return 100
return views.pageViewLastDay > 0
? ((views.userView - views.userViewLastDay) / views.userViewLastDay * 100).toFixed(2)
: 100
},
[views?.userView, views?.userViewLastDay],
)

if (!(views.pageView || views.pageViewLastDay || views.userView || views.userViewLastDay)) return null
if (!(views?.pageView || views?.pageViewLastDay || views?.userView || views?.userViewLastDay)) return null

return (
<>
Expand All @@ -58,7 +64,7 @@ const View = ({ views }: Props) => {
<StatGroup>
<Stat>
<StatLabel>{t('pv')}(PV)</StatLabel>
<StatNumber>{views.pageView}</StatNumber>
<StatNumber>{views?.pageView}</StatNumber>
<StatHelpText>
<StatArrow type="increase" />
{pageViewTrend}%
Expand All @@ -67,7 +73,7 @@ const View = ({ views }: Props) => {

<Stat>
<StatLabel>{t('uv')}(UV)</StatLabel>
<StatNumber>{views.userView}</StatNumber>
<StatNumber>{views?.userView}</StatNumber>
<StatHelpText>
<StatArrow type="increase" />
{userViewTrend}%
Expand All @@ -76,18 +82,18 @@ const View = ({ views }: Props) => {

<Stat>
<StatLabel>{t('activeUser')}</StatLabel>
<StatNumber>{views.activeUser ?? 0}</StatNumber>
<StatNumber>{views?.activeUser ?? 0}</StatNumber>
</Stat>
</StatGroup>
</Card>
</Wrapper>
<Wrapper>
<Flex gap="8">
{
views.pvPathGroupResult.length > 0 && (
views?.pvPathGroupResult.length > 0 && (
<Card flex="1">
<TrendChart
data={views.pvPathGroupResult}
data={views?.pvPathGroupResult}
name="number"
timeField="value"
title={
Expand All @@ -104,10 +110,10 @@ const View = ({ views }: Props) => {
)
}
{
views.pvReferrerGroupResult.length > 0 && (
views?.pvReferrerGroupResult.length > 0 && (
<Card flex="1">
<TrendChart
data={views.pvReferrerGroupResult}
data={views?.pvReferrerGroupResult}
name="number"
timeField="value"
title={
Expand Down Expand Up @@ -168,10 +174,10 @@ const Trend = ({ trends }: Props) => {
}
const Events = ({ project }: Props) => {
const { data, size, setSize, isLoading, isReachingEnd } = useInfinite<Event>(
index => serviceGetEventByProjectId({ projectId: project.id, page: index + 1 }),
index => serviceGetEventByProjectId({ projectId: project!.id, page: index + 1 }),
{
enabled: project.id !== undefined,
deps: [project.id],
enabled: project?.id !== undefined,
deps: [project?.id],
},
)

Expand Down
1 change: 1 addition & 0 deletions packages/web/app/[locale]/auth/signin/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ async function getInviter(userId: string | null, projectId: string | null) {
}
}
}
return undefined
}

export const metadata: Metadata = { title: 'SignIn | Ohbug' }
Expand Down
2 changes: 1 addition & 1 deletion packages/web/components/issueList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ const IssueList: FC<Props> = ({ empty }) => {
</CheckboxGroup>

{
data?.length > 0 && (
!!data?.length && (
<Flex
alignItems="center"
justifyContent="space-between"
Expand Down
2 changes: 1 addition & 1 deletion packages/web/components/releaseList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const ReleaseList: FC<Props> = ({ releases, mutate }) => {
direction="column"
flex="1"
>
<Link fontWeight="semibold">{release.appVersion}</Link>
<Text fontWeight="semibold">{release.appVersion}</Text>
<Text
as="span"
color="dimgray"
Expand Down

0 comments on commit 9ae5eb8

Please sign in to comment.