mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-19 10:26:17 +00:00
make gallery year tag clickable (#7381)
Co-authored-by: zhouwenxuan <aries@Mac.local>
This commit is contained in:
@@ -136,6 +136,8 @@ const Content = ({
|
||||
'onContextMenu': onContextMenu,
|
||||
};
|
||||
|
||||
const isDateTagClickable = mode === GALLERY_DATE_MODE.MONTH || mode === GALLERY_DATE_MODE.YEAR;
|
||||
|
||||
return (
|
||||
<div
|
||||
key={name}
|
||||
@@ -144,12 +146,12 @@ const Content = ({
|
||||
>
|
||||
{mode !== GALLERY_DATE_MODE.ALL && childrenStartIndex === 0 && (
|
||||
<div
|
||||
className={classNames('metadata-gallery-date-tag', { 'hover': mode === GALLERY_DATE_MODE.MONTH })}
|
||||
className={classNames('metadata-gallery-date-tag', { 'hover': isDateTagClickable })}
|
||||
style={{ height: paddingTop }}
|
||||
onClick={(event) => onDateTagClick(event, name)}
|
||||
>
|
||||
{name || gettext('Empty')}
|
||||
{mode === GALLERY_DATE_MODE.MONTH && <i className="metadata-gallery-date-tag-arrow sf3-font-down sf3-font rotate-270" />}
|
||||
{isDateTagClickable && <i className="metadata-gallery-date-tag-arrow sf3-font-down sf3-font rotate-270" />}
|
||||
</div>
|
||||
)}
|
||||
<div
|
||||
|
@@ -286,11 +286,13 @@ const Main = ({ isLoadingMore, metadata, onDelete, onLoadMore, duplicateRecord,
|
||||
|
||||
const handleDateTagClick = useCallback((event, groupName) => {
|
||||
event.preventDefault();
|
||||
if (mode === GALLERY_DATE_MODE.MONTH) {
|
||||
const image = groups.find(group => group.name === groupName)?.children[0]?.children[0];
|
||||
if (image) {
|
||||
lastState.current = { ...lastState.current, targetGroupFirstImageId: image.id };
|
||||
}
|
||||
if (mode === GALLERY_DATE_MODE.YEAR) {
|
||||
window.sfMetadataContext.eventBus.dispatch(EVENT_BUS_TYPE.SWITCH_GALLERY_GROUP_BY, GALLERY_DATE_MODE.MONTH);
|
||||
} else if (mode === GALLERY_DATE_MODE.MONTH) {
|
||||
window.sfMetadataContext.eventBus.dispatch(EVENT_BUS_TYPE.SWITCH_GALLERY_GROUP_BY, GALLERY_DATE_MODE.DAY);
|
||||
}
|
||||
}, [mode, groups]);
|
||||
|
Reference in New Issue
Block a user