mirror of
https://github.com/morpheus65535/bazarr.git
synced 2025-01-09 08:17:42 +08:00
Improve style of release text in manual search modal
This commit is contained in:
parent
f35980ce38
commit
875eb013cc
3 changed files with 80 additions and 39 deletions
|
@ -19,18 +19,3 @@ body {
|
||||||
.progress-bar {
|
.progress-bar {
|
||||||
cursor: default;
|
cursor: default;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dropdown-toggle-wrap {
|
|
||||||
position: relative;
|
|
||||||
&::after {
|
|
||||||
position: absolute;
|
|
||||||
right: 0.1rem;
|
|
||||||
bottom: 50%;
|
|
||||||
}
|
|
||||||
span {
|
|
||||||
display: block;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
overflow: hidden;
|
|
||||||
max-width: 500px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import {
|
import {
|
||||||
|
faCaretDown,
|
||||||
faCheck,
|
faCheck,
|
||||||
faDownload,
|
faDownload,
|
||||||
faInfoCircle,
|
faInfoCircle,
|
||||||
|
@ -16,8 +17,8 @@ import {
|
||||||
Badge,
|
Badge,
|
||||||
Button,
|
Button,
|
||||||
Col,
|
Col,
|
||||||
|
Collapse,
|
||||||
Container,
|
Container,
|
||||||
Dropdown,
|
|
||||||
OverlayTrigger,
|
OverlayTrigger,
|
||||||
Popover,
|
Popover,
|
||||||
Row,
|
Row,
|
||||||
|
@ -34,6 +35,7 @@ import {
|
||||||
} from "..";
|
} from "..";
|
||||||
import { ProvidersApi } from "../../apis";
|
import { ProvidersApi } from "../../apis";
|
||||||
import { isMovie } from "../../utilites";
|
import { isMovie } from "../../utilites";
|
||||||
|
import "./msmStyle.scss";
|
||||||
|
|
||||||
type SupportType = Item.Movie | Item.Episode;
|
type SupportType = Item.Movie | Item.Episode;
|
||||||
|
|
||||||
|
@ -53,8 +55,25 @@ export const ManualSearchModal: FunctionComponent<Props & BaseModalProps> = (
|
||||||
) => {
|
) => {
|
||||||
const { onSelect, onDownload, ...modal } = props;
|
const { onSelect, onDownload, ...modal } = props;
|
||||||
|
|
||||||
const [result, setResult] = useState<SearchResultType[]>([]);
|
const [result, setResult] = useState<SearchResultType[]>([
|
||||||
const [searchState, setSearchState] = useState(SearchState.Ready);
|
{
|
||||||
|
matches: [],
|
||||||
|
dont_matches: [],
|
||||||
|
language: "zh",
|
||||||
|
forced: "True",
|
||||||
|
hearing_impaired: "True",
|
||||||
|
orig_score: 100,
|
||||||
|
provider: "assrt",
|
||||||
|
release_info: [
|
||||||
|
"ladbgklsafbsbfliksbfiasvbgsdbfashfsdgvfvasblgvbsdlfagviugas",
|
||||||
|
"ailuysdbliaubfhysvaugsdhfahjsdfhjasoi;fhsdfb",
|
||||||
|
],
|
||||||
|
score: 99,
|
||||||
|
score_without_hash: 99,
|
||||||
|
subtitle: {},
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
const [searchState, setSearchState] = useState(SearchState.Finished);
|
||||||
|
|
||||||
const item = usePayload<SupportType>(modal.modalKey);
|
const item = usePayload<SupportType>(modal.modalKey);
|
||||||
|
|
||||||
|
@ -74,7 +93,7 @@ export const ManualSearchModal: FunctionComponent<Props & BaseModalProps> = (
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (item !== null) {
|
if (item !== null) {
|
||||||
setSearchState(SearchState.Ready);
|
// setSearchState(SearchState.Ready);
|
||||||
}
|
}
|
||||||
}, [item]);
|
}, [item]);
|
||||||
|
|
||||||
|
@ -124,34 +143,51 @@ export const ManualSearchModal: FunctionComponent<Props & BaseModalProps> = (
|
||||||
Cell: (row) => {
|
Cell: (row) => {
|
||||||
const value = row.value;
|
const value = row.value;
|
||||||
|
|
||||||
|
const [open, setOpen] = useState(false);
|
||||||
|
|
||||||
const items = useMemo(
|
const items = useMemo(
|
||||||
() =>
|
() =>
|
||||||
value.map((v, idx) => (
|
value.slice(1).map((v, idx) => (
|
||||||
<Dropdown.Item key={idx} disabled className="text-dark">
|
<span className="release-text hidden-item" key={idx}>
|
||||||
{v}
|
{v}
|
||||||
</Dropdown.Item>
|
</span>
|
||||||
)),
|
)),
|
||||||
[value]
|
[value]
|
||||||
);
|
);
|
||||||
|
|
||||||
if (value.length !== 0) {
|
if (value.length === 0) {
|
||||||
const display = value[0];
|
return <span className="text-muted">Cannot get release info</span>;
|
||||||
return (
|
|
||||||
<Dropdown>
|
|
||||||
<Dropdown.Toggle
|
|
||||||
className="dropdown-hidden text-dark dropdown-toggle-wrap"
|
|
||||||
title={display}
|
|
||||||
variant={"light"}
|
|
||||||
size={"sm"}
|
|
||||||
>
|
|
||||||
<span>{display}</span>
|
|
||||||
</Dropdown.Toggle>
|
|
||||||
<Dropdown.Menu>{items}</Dropdown.Menu>
|
|
||||||
</Dropdown>
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return "Cannot get release info";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const cls = [
|
||||||
|
"release-container",
|
||||||
|
"d-flex",
|
||||||
|
"justify-content-between",
|
||||||
|
"align-items-center",
|
||||||
|
];
|
||||||
|
|
||||||
|
if (value.length > 1) {
|
||||||
|
cls.push("release-multi");
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={cls.join(" ")} onClick={() => setOpen((o) => !o)}>
|
||||||
|
<div className="text-container">
|
||||||
|
<span className="release-text">{value[0]}</span>
|
||||||
|
<Collapse in={open}>
|
||||||
|
<div>{items}</div>
|
||||||
|
</Collapse>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{value.length > 1 && (
|
||||||
|
<FontAwesomeIcon
|
||||||
|
className="release-icon"
|
||||||
|
icon={faCaretDown}
|
||||||
|
rotation={open ? 180 : undefined}
|
||||||
|
></FontAwesomeIcon>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
20
frontend/src/components/modals/msmStyle.scss
Normal file
20
frontend/src/components/modals/msmStyle.scss
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
.release-container {
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
.text-container {
|
||||||
|
max-width: 500px;
|
||||||
|
.release-text {
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
word-wrap: break-word;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
|
||||||
|
&.hidden-item {
|
||||||
|
color: gray;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.release-multi {
|
||||||
|
cursor: zoom-in;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue