prop to hide displayAs selector
This commit is contained in:
parent
1330db056a
commit
ad163625c3
@ -5,9 +5,11 @@ export type DisplayAs = "grid" | "feed";
|
|||||||
type DisplaySelectorProps = {
|
type DisplaySelectorProps = {
|
||||||
activeSelection: DisplayAs;
|
activeSelection: DisplayAs;
|
||||||
onSelect: (display: DisplayAs) => void;
|
onSelect: (display: DisplayAs) => void;
|
||||||
|
show?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const DisplayAsSelector = ({ activeSelection, onSelect }: DisplaySelectorProps) => {
|
export const DisplayAsSelector = ({ activeSelection, onSelect, show }: DisplaySelectorProps) => {
|
||||||
|
if (show === false) return null;
|
||||||
return (
|
return (
|
||||||
<div className="flex mb-4">
|
<div className="flex mb-4">
|
||||||
<div
|
<div
|
||||||
|
@ -21,6 +21,7 @@ export interface TimelineProps {
|
|||||||
loadMore?: boolean;
|
loadMore?: boolean;
|
||||||
noSort?: boolean;
|
noSort?: boolean;
|
||||||
displayAs?: DisplayAs;
|
displayAs?: DisplayAs;
|
||||||
|
showDisplayAsSelector?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -73,7 +74,7 @@ const Timeline = (props: TimelineProps) => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<LiveStreams evs={liveStreams} />
|
<LiveStreams evs={liveStreams} />
|
||||||
<DisplayAsSelector activeSelection={displayAs} onSelect={(displayAs: DisplayAs) => setDisplayAs(displayAs)} />
|
<DisplayAsSelector show={props.showDisplayAsSelector} activeSelection={displayAs} onSelect={(displayAs: DisplayAs) => setDisplayAs(displayAs)} />
|
||||||
<TimelineRenderer
|
<TimelineRenderer
|
||||||
frags={[
|
frags={[
|
||||||
{
|
{
|
||||||
|
@ -22,6 +22,7 @@ export interface TimelineFollowsProps {
|
|||||||
noteRenderer?: (ev: NostrEvent) => ReactNode;
|
noteRenderer?: (ev: NostrEvent) => ReactNode;
|
||||||
noteOnClick?: (ev: NostrEvent) => void;
|
noteOnClick?: (ev: NostrEvent) => void;
|
||||||
displayAs?: DisplayAs;
|
displayAs?: DisplayAs;
|
||||||
|
showDisplayAsSelector?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -108,7 +109,7 @@ const TimelineFollows = (props: TimelineFollowsProps) => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{(props.liveStreams ?? true) && <LiveStreams evs={liveStreams} />}
|
{(props.liveStreams ?? true) && <LiveStreams evs={liveStreams} />}
|
||||||
<DisplayAsSelector activeSelection={displayAs} onSelect={(displayAs: DisplayAs) => setDisplayAs(displayAs)} />
|
<DisplayAsSelector show={props.showDisplayAsSelector} activeSelection={displayAs} onSelect={(displayAs: DisplayAs) => setDisplayAs(displayAs)} />
|
||||||
<TimelineRenderer
|
<TimelineRenderer
|
||||||
frags={[{ events: orderDescending(mainFeed.concat(mixinFiltered)), refTime: latest }]}
|
frags={[{ events: orderDescending(mainFeed.concat(mixinFiltered)), refTime: latest }]}
|
||||||
related={reactions.data ?? []}
|
related={reactions.data ?? []}
|
||||||
|
@ -173,6 +173,7 @@ function MediaCol({ setThread }: { setThread: (e: NostrLink) => void }) {
|
|||||||
return images.length > 0;
|
return images.length > 0;
|
||||||
}}
|
}}
|
||||||
displayAs="grid"
|
displayAs="grid"
|
||||||
|
showDisplayAsSelector={false}
|
||||||
noteOnClick={e => setThread(NostrLink.fromEvent(e))}
|
noteOnClick={e => setThread(NostrLink.fromEvent(e))}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user