mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
parent
df9b9029f4
commit
ab05d1d6e6
2 changed files with 11 additions and 14 deletions
|
|
@ -5,25 +5,24 @@ import React from "react";
|
|||
|
||||
interface Props {
|
||||
name: string;
|
||||
viewUrl: string;
|
||||
viewUrlMirrors: string[];
|
||||
viewUrls: string[];
|
||||
}
|
||||
|
||||
export const SubscribeButtons = (props: Props) =>
|
||||
props.viewUrl ? (
|
||||
props.viewUrls.length ? (
|
||||
<>
|
||||
<SubscribeButton
|
||||
name={props.name}
|
||||
viewUrl={props.viewUrl}
|
||||
viewUrl={props.viewUrls[0]}
|
||||
text="Subscribe"
|
||||
/>
|
||||
<MirrorButtons name={props.name} viewUrlMirrors={props.viewUrlMirrors} />
|
||||
<MirrorButtons name={props.name} viewUrlMirrors={props.viewUrls.slice(1)} />
|
||||
</>
|
||||
) : null;
|
||||
|
||||
interface MirrorButtonsProps {
|
||||
name: string;
|
||||
viewUrlMirrors: string[];
|
||||
viewUrlMirrors: string[] | undefined;
|
||||
}
|
||||
|
||||
const MirrorButtons = (props: MirrorButtonsProps) => (
|
||||
|
|
|
|||
|
|
@ -72,9 +72,8 @@ export const ListInfoDrawer = (props: RouteComponentProps & Props) => {
|
|||
document.title = originalTitle;
|
||||
};
|
||||
}, [list, originalTitle, listName]);
|
||||
const viewUrl = list?.viewUrls.find(
|
||||
(u) => u.primariness === 1 && u.segmentNumber === 1
|
||||
)?.url;
|
||||
const viewUrlModels = list?.viewUrls.filter((u) => u.segmentNumber === 1);
|
||||
const viewUrls = viewUrlModels == null ? [] : viewUrlModels.map(u => u.url);
|
||||
return list ? (
|
||||
<Drawer
|
||||
visible={true}
|
||||
|
|
@ -100,16 +99,15 @@ export const ListInfoDrawer = (props: RouteComponentProps & Props) => {
|
|||
<Maintainers maintainers={listMaintainers} />
|
||||
<Divider />
|
||||
<ButtonGroup style={{ display: "inherit" }}>
|
||||
{viewUrl && (
|
||||
{viewUrls.length && (
|
||||
<SubscribeButtons
|
||||
name={list.name}
|
||||
viewUrl={viewUrl}
|
||||
viewUrlMirrors={[]}
|
||||
viewUrls={viewUrls}
|
||||
/>
|
||||
)}
|
||||
{viewUrl && (
|
||||
{viewUrlModels && (
|
||||
<LinkButton
|
||||
url={viewUrl}
|
||||
url={viewUrls[0]}
|
||||
text="View"
|
||||
title={`View ${list.name} in its raw format`}
|
||||
icon={<SearchOutlined />}
|
||||
|
|
|
|||
Loading…
Reference in a new issue