diff --git a/front/src/components/Gallery/index.tsx b/front/src/components/Gallery/index.tsx index 402ce45..ed133df 100644 --- a/front/src/components/Gallery/index.tsx +++ b/front/src/components/Gallery/index.tsx @@ -3,7 +3,7 @@ import React, { useEffect, useMemo, useState } from 'react' import './index.scss' import Title from 'components/Title' -import Waterfall, { WaterfallLayoutConfigure } from 'components/Waterfall' +import Waterfall, { WaterfallLayoutConfigure, Props as WaterfallLayoutProps } from 'components/Waterfall' import { Gallery, Photo } from 'api/photo' import { CoverClickEvent, Props as PhotoBoxProps } from 'components/PhotoBox' import Submission from 'components/Submission' @@ -135,13 +135,13 @@ export type Props = { cannot_select_vote?: boolean show_vote_button: boolean gallery: Gallery - selectedIdList: number[] + selected_id_list: WaterfallLayoutProps['selected_id_list'] onClickVote?: (photo_id: Photo['id']) => void onClickCover: (clickInfo: CoverClickEvent, photo_id: Photo['id']) => void } export default ({ cannot_select_vote = false, - show_vote_button, gallery, selectedIdList, onClickVote, onClickCover, + show_vote_button, gallery, selected_id_list, onClickVote, onClickCover, }: Props) => { const layout = useWaterfallLayout(gallery) @@ -152,14 +152,14 @@ export default ({ layout_configure={layout} cannot_select_vote={cannot_select_vote} photos={gallery.photos} - selectedIdList={selectedIdList} + selected_id_list={selected_id_list} show_vote_button={show_vote_button} onClickCover={onClickCover} onClickVote={(photoId) => { onClickVote && onClickVote(photoId) }} /> - ), [cannot_select_vote, gallery.photos, show_vote_button, layout, onClickCover, onClickVote, selectedIdList]) + ), [cannot_select_vote, gallery.photos, show_vote_button, layout, onClickCover, onClickVote, selected_id_list]) return (
diff --git a/front/src/components/PhotoBox/index.tsx b/front/src/components/PhotoBox/index.tsx index 8604815..c068ba3 100644 --- a/front/src/components/PhotoBox/index.tsx +++ b/front/src/components/PhotoBox/index.tsx @@ -87,7 +87,6 @@ export const PhotoBoxDimension = forwardRef< DimensionUnknown, Props>((props, re const PhotoBox = forwardRef((props, ref) => { const { type, vertial_gutter, box_width, photo, hideMember, avatar, desc, style, vote_button_status } = props - const vote_button_is_highlight = vote_button_status === 'selected' const [thumb_loaded, thumb] = useQueueload(photo.thumb) const [avatar_loaded, avatarThumb] = useQueueload(avatar?.thumb) diff --git a/front/src/components/Waterfall/index.tsx b/front/src/components/Waterfall/index.tsx index a6b5088..6578605 100644 --- a/front/src/components/Waterfall/index.tsx +++ b/front/src/components/Waterfall/index.tsx @@ -44,7 +44,7 @@ export type Props = { onClickVote(photo_id: Photo['id']): void onClickCover: WaterfallLayoutClickCoverHandler - selectedIdList: number[] + selected_id_list: number[] } function calcTotalBoxWidth({ @@ -62,7 +62,7 @@ export default (props: Props) => { show_vote_button, layout_configure, photos, - selectedIdList + selected_id_list } = props const { box_type, vertial_gutter, gallery_width } = layout_configure const [ box_width ] = calcTotalBoxWidth(layout_configure) @@ -118,7 +118,7 @@ export default (props: Props) => { show_vote_button: show_vote_button, hideMember: !photo.member, vote_button_status: ( - (selectedIdList && (selectedIdList.indexOf(photo.id) !== -1)) ? + (selected_id_list && (selected_id_list.indexOf(photo.id) !== -1)) ? 'selected' : (props.cannot_select_vote ? 'cannot-select' : 'un-selected') ), diff --git a/front/src/utils/queue-load.ts b/front/src/utils/queue-load.ts index 0e83973..14a9e28 100644 --- a/front/src/utils/queue-load.ts +++ b/front/src/utils/queue-load.ts @@ -5,6 +5,8 @@ import { findListByProperty, removeListItemByIdx } from './common' import download from './download' import useSafeState from 'hooks/useSafeState' +export const __MAX_PARALLEL_NUMBER__ = 3 + type Load = { blob: Blob; blobUrl: string; @@ -73,8 +75,6 @@ export function useQueueload(loadsrc: string | undefined, need_base64_url: boole return [loaded, back_src] as const } -export const MAX_PARALLEL_NUMBER = 3 - type Src = string type LoadTask = { src: Src @@ -107,7 +107,7 @@ export function QueueLoad() { return } else if ( isLoading() && - ( getConcurrentTasks().length >= MAX_PARALLEL_NUMBER ) + ( getConcurrentTasks().length >= __MAX_PARALLEL_NUMBER__ ) ) { return } else {