forked from Kieran/snort
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 = {
|
||||
activeSelection: DisplayAs;
|
||||
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 (
|
||||
<div className="flex mb-4">
|
||||
<div
|
||||
|
@ -21,6 +21,7 @@ export interface TimelineProps {
|
||||
loadMore?: boolean;
|
||||
noSort?: boolean;
|
||||
displayAs?: DisplayAs;
|
||||
showDisplayAsSelector?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -73,7 +74,7 @@ const Timeline = (props: TimelineProps) => {
|
||||
return (
|
||||
<>
|
||||
<LiveStreams evs={liveStreams} />
|
||||
<DisplayAsSelector activeSelection={displayAs} onSelect={(displayAs: DisplayAs) => setDisplayAs(displayAs)} />
|
||||
<DisplayAsSelector show={props.showDisplayAsSelector} activeSelection={displayAs} onSelect={(displayAs: DisplayAs) => setDisplayAs(displayAs)} />
|
||||
<TimelineRenderer
|
||||
frags={[
|
||||
{
|
||||
|
@ -22,6 +22,7 @@ export interface TimelineFollowsProps {
|
||||
noteRenderer?: (ev: NostrEvent) => ReactNode;
|
||||
noteOnClick?: (ev: NostrEvent) => void;
|
||||
displayAs?: DisplayAs;
|
||||
showDisplayAsSelector?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -108,7 +109,7 @@ const TimelineFollows = (props: TimelineFollowsProps) => {
|
||||
return (
|
||||
<>
|
||||
{(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
|
||||
frags={[{ events: orderDescending(mainFeed.concat(mixinFiltered)), refTime: latest }]}
|
||||
related={reactions.data ?? []}
|
||||
|
@ -173,6 +173,7 @@ function MediaCol({ setThread }: { setThread: (e: NostrLink) => void }) {
|
||||
return images.length > 0;
|
||||
}}
|
||||
displayAs="grid"
|
||||
showDisplayAsSelector={false}
|
||||
noteOnClick={e => setThread(NostrLink.fromEvent(e))}
|
||||
/>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user