diff --git a/src/components/ClubSearchTable.tsx b/src/components/ClubSearchTable.tsx index 9f6cf5b..d76443b 100644 --- a/src/components/ClubSearchTable.tsx +++ b/src/components/ClubSearchTable.tsx @@ -19,7 +19,7 @@ enum ClubType { 我的收藏, } -type Data = { clubs: ClubInfo[], total: number, page: number; }; +type Data = { clubs: Pick[], total: number, page: number; }; const initData = { clubs: [], total: 0, page: 1 }; diff --git a/src/components/ClubSummary.tsx b/src/components/ClubSummary.tsx index 73876d5..1c8e486 100644 --- a/src/components/ClubSummary.tsx +++ b/src/components/ClubSummary.tsx @@ -5,7 +5,8 @@ import { useRequest } from "ahooks"; import type { ClubDetail } from "../types"; import { MapType, openWebMapRaw } from "../utils/front"; import type { ItemType } from "antd/es/menu/interface"; -import { NotificationOutlined, PushpinOutlined } from "@ant-design/icons"; +import { NotificationOutlined, PushpinOutlined, StarFilled, StarOutlined } from "@ant-design/icons"; +import { useClubStore } from "../store/useClubStore"; interface Props { clubId: string; @@ -43,6 +44,7 @@ export const ClubSummary = (props: Props) => { }, ] }, [info]); + const store = useClubStore(); if (requestClubSummary.data === null) return null; return (
@@ -52,7 +54,29 @@ export const ClubSummary = (props: Props) => { - {info?.name} + + + {info?.name} + {props.clubId === '47' ? null : (store.isFav(info?.id ?? '')) ? ( + + ) : ( + + )} + + {noArticle ? null : ( diff --git a/src/components/GameSelector/clubList.ts b/src/components/GameSelector/clubList.ts index 32974ea..379919c 100644 --- a/src/components/GameSelector/clubList.ts +++ b/src/components/GameSelector/clubList.ts @@ -1,6 +1,6 @@ export const clubs = [ { - name: '东华', + name: '东华乒乓球俱乐部', clubId: '47', }, ]; \ No newline at end of file diff --git a/src/store/useClubStore.ts b/src/store/useClubStore.ts index d7fb2d0..46125eb 100644 --- a/src/store/useClubStore.ts +++ b/src/store/useClubStore.ts @@ -1,17 +1,16 @@ import { create } from "zustand"; import { persist, createJSONStorage } from 'zustand/middleware'; -import type { ClubInfo } from "../types"; interface Store { - clubs: ClubInfo[]; - add(club: ClubInfo): void; + clubs: { id: string; name: string }[]; + add(club: { id: string; name: string }): void; unFav(id: string): void; isFav(id: string): boolean; } export const useClubStore = create(persist((set, get) => { return { clubs: [], - add: (club: ClubInfo) => { + add: (club: { id: string; name: string }) => { set({ clubs: [...get().clubs, club] }); }, unFav: (id: string) => {