-
Notifications
You must be signed in to change notification settings - Fork 373
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
feat: metadata gallery view
杨国璇
committed
Sep 7, 2024
1 parent
05e8573
commit 27cc63c
Showing
20 changed files
with
411 additions
and
159 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 7 additions & 10 deletions
17
frontend/src/metadata/metadata-view/components/data-process-setter/slider-setter.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
...etadata/metadata-view/components/popover/filter-popover/basic-filters/file-type-filter.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import React, { useCallback, useMemo } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { gettext } from '../../../../utils'; | ||
import { CustomizeSelect, Icon } from '@seafile/sf-metadata-ui-component'; | ||
|
||
const OPTIONS = [ | ||
{ value: 'picture', name: gettext('Only pictures') }, | ||
{ value: 'video', name: gettext('Only videos') }, | ||
{ value: 'all', name: gettext('Pictures and videos') }, | ||
]; | ||
|
||
const FileTypeFilter = ({ readOnly, value = 'picture', onChange: onChangeAPI }) => { | ||
|
||
const options = useMemo(() => { | ||
return OPTIONS.map(o => { | ||
const { name } = o; | ||
return { | ||
value: o.value, | ||
label: ( | ||
<div className="select-basic-filter-option"> | ||
<div className="select-basic-filter-option-name" title={name} aria-label={name}>{name}</div> | ||
<div className="select-basic-filter-option-check-icon"> | ||
{value === o.value && (<Icon iconName="check-mark" />)} | ||
</div> | ||
</div> | ||
) | ||
}; | ||
}); | ||
}, [value]); | ||
|
||
const displayValue = useMemo(() => { | ||
const selectedOption = OPTIONS.find(o => o.value === value) || OPTIONS[2]; | ||
return { | ||
label: ( | ||
<div> | ||
{selectedOption.name} | ||
</div> | ||
) | ||
}; | ||
}, [value]); | ||
|
||
const onChange = useCallback((newValue) => { | ||
if (newValue === value) return; | ||
onChangeAPI(newValue); | ||
}, [value, onChangeAPI]); | ||
|
||
return ( | ||
<CustomizeSelect | ||
readOnly={readOnly} | ||
className="sf-metadata-basic-filters-select" | ||
value={displayValue} | ||
options={options} | ||
onSelectOption={onChange} | ||
component={{ | ||
DropDownIcon: ( | ||
<i className="sf3-font sf3-font-down"></i> | ||
) | ||
}} | ||
/> | ||
); | ||
}; | ||
|
||
FileTypeFilter.propTypes = { | ||
readOnly: PropTypes.bool, | ||
value: PropTypes.string, | ||
onChange: PropTypes.func, | ||
}; | ||
|
||
export default FileTypeFilter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.