Skip to content

Commit

Permalink
feat: show meta block for all pages, add assets storage for x_photo
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamerblue committed Dec 14, 2024
1 parent 5e6b2d1 commit d3299d5
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .umirc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default defineConfig({
'process.env.HOST_CN': 'rl.algoux.cn',
'process.env.BEIAN': '鲁ICP备18021776号-5',
'process.env.LIVE_POLLING_INTERVAL': '10000',
'process.env.X_PHOTO_BASE': 'https://share-bj-1252277595.cos.ap-beijing.myqcloud.com/',
'process.env.X_PHOTO_BASE': 'https://share-bj-1252277595.cos.ap-beijing.myqcloud.com/srk-storage',
'GTAG': siteAlias === 'cn' ? 'G-D4PSNCRQJC' : 'G-D6CVTJBDZT',
},
ssr: {
Expand Down
16 changes: 9 additions & 7 deletions src/components/StyledRanklistRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -282,15 +282,17 @@ export default function StyledRanklistRenderer({
const renderHeader = () => {
const startAt = new Date(staticData.contest.startAt).getTime();
const endAt = startAt + formatSrkTimeDuration(staticData.contest.duration, 'ms');
const metaBlock = !meta ? null : (
const metaBlock = (
<div className="text-center mt-1">
<span className="mr-2">
<EyeOutlined /> {meta.viewCnt || '-'}
</span>
{meta && (
<span className="mr-2">
<EyeOutlined /> {meta.viewCnt || '-'}
</span>
)}
<ClientOnly>
{() => (
<>
<a className="pl-2 border-0 border-l border-solid border-gray-400 mr-2">
<a className={`border-0 border-solid border-gray-400 mr-2 ${meta ? 'pl-2 border-l' : ''}`}>
<Dropdown
overlay={
<Menu
Expand Down Expand Up @@ -459,15 +461,15 @@ export default function StyledRanklistRenderer({
return {
title: user.name,
width: clientWidth >= 980 ? 960 : clientWidth - 20,
content: <UserInfoModal user={user} row={row} index={index} ranklist={ranklist} />,
content: <UserInfoModal user={user} row={row} index={index} ranklist={ranklist} assetsScope={id!} />,
};
}}
/>
</RankTimeDataContext.Provider>
</div>
{showFooter && (
<div className="text-center mt-8">
<p className="mb-0">© 2022-2023 algoUX. All Rights Reserved.</p>
<p className="mb-0">© 2022-present algoUX. All Rights Reserved.</p>
<p className="mt-1 mb-0">
Find us on{' '}
<a href="https://github.com/algoux" target="_blank">
Expand Down
5 changes: 3 additions & 2 deletions src/components/UserInfoModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ export interface IUserInfoModalProps {
row: srk.RanklistRow;
index: number;
ranklist: srk.Ranklist;
assetsScope: string;
}

export default function UserInfoModal(props: IUserInfoModalProps) {
const { user, row, ranklist } = props;
const { user, row, ranklist, assetsScope } = props;
const rankTimeData = useContext(RankTimeDataContext);
// @ts-ignore
const mainSegmentIndex = row.rankValues[0]?.segmentIndex;
Expand Down Expand Up @@ -56,7 +57,7 @@ export default function UserInfoModal(props: IUserInfoModalProps) {
<img
id={id}
key={id}
src={`${process.env.X_PHOTO_BASE}${photo}`}
src={`${process.env.X_PHOTO_BASE}/${assetsScope}/${photo}`}
alt="选手照片"
style={{ width: '100%' }}
onError={handleImgError}
Expand Down
1 change: 0 additions & 1 deletion src/pages/collection/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import { useClientWidthHeight } from '@/hooks/use-client-wh';
import { useLocalStorageState } from 'ahooks';
import { LocalStorageKey } from '@/configs/local-storage-key.config';
import { extractQueryParams, formatUrl } from '@/configs/route.config';
import UserInfoModal from '@/components/UserInfoModal';

type MenuItem = Required<MenuProps>['items'][number];

Expand Down
1 change: 0 additions & 1 deletion src/pages/live/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { parseRealtimeSolutionBuffer } from '@/utils/realtime-solutions.util';
import ScrollSolution from '@/components/plugins/ScrollSolution/ScrollSolution';
import { useRemainingHeight } from '@/hooks/use-remaining-height';
import { useClientWidthHeight } from '@/hooks/use-client-wh';
import UserInfoModal from '@/components/UserInfoModal';

const POLL_RANKLIST_INTERVAL = Number(process.env.LIVE_POLLING_INTERVAL);

Expand Down
1 change: 0 additions & 1 deletion src/pages/ranklist/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { api } from '@/services/api';
import { Button, Spin } from 'antd';
import { LogicException, LogicExceptionKind } from '@/services/api/logic.exception';
import { formatTitle } from '@/utils/title-format.util';
import UserInfoModal from '@/components/UserInfoModal';
import { useClientWidthHeight } from '@/hooks/use-client-wh';

export default function RanklistPage(props: IRanklistPageProps) {
Expand Down

0 comments on commit d3299d5

Please sign in to comment.