fix some warnings
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Martti Malmi 2024-01-10 18:53:35 +02:00
parent 7220435d15
commit 8e37e0fbed
15 changed files with 450 additions and 447 deletions

View File

@ -7,14 +7,14 @@ import Icon from "@/Components/Icons/Icon";
import { ProxyImg } from "@/Components/ProxyImg";
import getEventMedia from "@/Utils/getEventMedia";
export interface ImageGridItemProps {
interface ImageGridItemProps {
event: TaggedNostrEvent;
onClick?: (event: MouseEvent) => void;
waitUntilInView?: boolean;
}
function ImageGridItem(props: ImageGridItemProps) {
const { event, onClick } = props;
const ImageGridItem = memo((props: ImageGridItemProps) => {
const { event, onClick, waitUntilInView } = props;
const { ref, inView } = useInView({ triggerOnce: true, rootMargin: "0px 0px 3000px 0px" });
const media = getEventMedia(event);
@ -33,7 +33,7 @@ function ImageGridItem(props: ImageGridItemProps) {
};
const renderContent = (): ReactNode | undefined => {
if (props.waitUntilInView && !inView) return undefined;
if (waitUntilInView && !inView) return undefined;
return (
<>
<ProxyImg src={media[0].content} alt="Note Media" size={311} className="w-full h-full object-cover" />
@ -54,6 +54,8 @@ function ImageGridItem(props: ImageGridItemProps) {
{renderContent()}
</Link>
);
}
});
export default memo(ImageGridItem);
ImageGridItem.displayName = "ImageGridItem";
export default ImageGridItem;

View File

@ -55,7 +55,7 @@ const Translators = [
bech32ToHex("npub1ust7u0v3qffejwhqee45r49zgcyewrcn99vdwkednd356c9resyqtnn3mj"), // Petri - FI
];
export const DonateLNURL = "donate@snort.social";
const DonateLNURL = "donate@snort.social";
const DonatePage = () => {
const [splits, setSplits] = useState<RevenueSplit[]>([]);

View File

@ -61,7 +61,7 @@ export default function Index() {
<div className="w-full max-w-screen-xl">
<div className="flex flex-row">
<NavSidebar />
<div className="flex flex-1 flex-col pb-safe-area w-full md:w-1/3">
<div className="flex flex-1 flex-col pb-safe-area-plus w-full md:w-1/3">
{!shouldHideHeader && <Header />}
<ErrorBoundary>
<Outlet />

View File

@ -1,26 +1,11 @@
import { FormattedMessage } from "react-intl";
import Nip5Service from "@/Components/Nip5Service";
import { ApiHost } from "@/Utils/Const";
import { SnortNostrAddressService } from "@/Pages/settings/SnortNostrAddressService";
import messages from "./messages";
export const SnortNostrAddressService = {
name: "Snort",
service: `${ApiHost}/api/v1/n5sp`,
link: "https://snort.social/",
supportLink: "https://snort.social/help",
about: <FormattedMessage {...messages.SnortSocialNip} />,
};
export const NostrPlebsService = {
name: "Nostr Plebs",
service: "https://nostrplebs.com/api/v1",
link: "https://nostrplebs.com/",
supportLink: "https://nostrplebs.com/manage",
about: <FormattedMessage {...messages.NostrPlebsNip} />,
};
export const Nip5Services = [SnortNostrAddressService];
const Nip5Services = [SnortNostrAddressService];
export default function NostrAddressPage() {
return (

View File

@ -45,14 +45,9 @@ import useHorizontalScroll from "@/Hooks/useHorizontalScroll";
import { useMuteList, usePinList } from "@/Hooks/useLists";
import useLogin from "@/Hooks/useLogin";
import useModeration from "@/Hooks/useModeration";
import ProfileTab, {
BookMarksTab,
FollowersTab,
FollowsTab,
ProfileTabType,
RelaysTab,
ZapsProfileTab,
} from "@/Pages/Profile/ProfileTab";
import ProfileTab from "@/Pages/Profile/ProfileTab";
import { BookMarksTab, FollowersTab, FollowsTab, RelaysTab, ZapsProfileTab } from "@/Pages/Profile/ProfileTabs";
import { ProfileTabType } from "@/Pages/Profile/ProfileTabType";
import { findTag, hexToBech32, parseId, unwrap } from "@/Utils";
import { EmailRegex } from "@/Utils/Const";
import { ZapTarget } from "@/Utils/Zapper";

View File

@ -1,67 +1,8 @@
import { HexKey, NostrLink, NostrPrefix } from "@snort/system";
import { FormattedMessage } from "react-intl";
import { default as ZapElement } from "@/Components/Event/Zap";
import Icon from "@/Components/Icons/Icon";
import RelaysMetadata from "@/Components/Relay/RelaysMetadata";
import { Tab } from "@/Components/Tabs/Tabs";
import Bookmarks from "@/Components/User/Bookmarks";
import FollowsList from "@/Components/User/FollowListBase";
import useFollowersFeed from "@/Feed/FollowersFeed";
import useFollowsFeed from "@/Feed/FollowsFeed";
import useRelaysFeed from "@/Feed/RelaysFeed";
import useZapsFeed from "@/Feed/ZapsFeed";
import { useBookmarkList } from "@/Hooks/useLists";
import { formatShort } from "@/Utils/Number";
import messages from "../messages";
export enum ProfileTabType {
NOTES = 0,
REACTIONS = 1,
FOLLOWERS = 2,
FOLLOWS = 3,
ZAPS = 4,
MUTED = 5,
BLOCKED = 6,
RELAYS = 7,
BOOKMARKS = 8,
}
export function ZapsProfileTab({ id }: { id: HexKey }) {
const zaps = useZapsFeed(new NostrLink(NostrPrefix.PublicKey, id));
const zapsTotal = zaps.reduce((acc, z) => acc + z.amount, 0);
return (
<>
<h2 className="p">
<FormattedMessage {...messages.Sats} values={{ n: formatShort(zapsTotal) }} />
</h2>
{zaps.map(z => (
<ZapElement key={z.id} showZapped={false} zap={z} />
))}
</>
);
}
export function FollowersTab({ id }: { id: HexKey }) {
const followers = useFollowersFeed(id);
return <FollowsList pubkeys={followers} showAbout={true} className="p" />;
}
export function FollowsTab({ id }: { id: HexKey }) {
const follows = useFollowsFeed(id);
return <FollowsList pubkeys={follows} showAbout={true} className="p" />;
}
export function RelaysTab({ id }: { id: HexKey }) {
const relays = useRelaysFeed(id);
return <RelaysMetadata relays={relays} />;
}
export function BookMarksTab({ id }: { id: HexKey }) {
const bookmarks = useBookmarkList(id);
return <Bookmarks pubkey={id} bookmarks={bookmarks} />;
}
import { ProfileTabType } from "@/Pages/Profile/ProfileTabType";
const ProfileTab = {
Notes: {

View File

@ -0,0 +1,11 @@
export enum ProfileTabType {
NOTES = 0,
REACTIONS = 1,
FOLLOWERS = 2,
FOLLOWS = 3,
ZAPS = 4,
MUTED = 5,
BLOCKED = 6,
RELAYS = 7,
BOOKMARKS = 8,
}

View File

@ -0,0 +1,49 @@
import { HexKey, NostrLink, NostrPrefix } from "@snort/system";
import { FormattedMessage } from "react-intl";
import Zap from "@/Components/Event/Zap";
import RelaysMetadata from "@/Components/Relay/RelaysMetadata";
import Bookmarks from "@/Components/User/Bookmarks";
import FollowsList from "@/Components/User/FollowListBase";
import useFollowersFeed from "@/Feed/FollowersFeed";
import useFollowsFeed from "@/Feed/FollowsFeed";
import useRelaysFeed from "@/Feed/RelaysFeed";
import useZapsFeed from "@/Feed/ZapsFeed";
import { useBookmarkList } from "@/Hooks/useLists";
import messages from "@/Pages/messages";
import { formatShort } from "@/Utils/Number";
export function ZapsProfileTab({ id }: { id: HexKey }) {
const zaps = useZapsFeed(new NostrLink(NostrPrefix.PublicKey, id));
const zapsTotal = zaps.reduce((acc, z) => acc + z.amount, 0);
return (
<>
<h2 className="p">
<FormattedMessage {...messages.Sats} values={{ n: formatShort(zapsTotal) }} />
</h2>
{zaps.map(z => (
<Zap key={z.id} showZapped={false} zap={z} />
))}
</>
);
}
export function FollowersTab({ id }: { id: HexKey }) {
const followers = useFollowersFeed(id);
return <FollowsList pubkeys={followers} showAbout={true} className="p" />;
}
export function FollowsTab({ id }: { id: HexKey }) {
const follows = useFollowsFeed(id);
return <FollowsList pubkeys={follows} showAbout={true} className="p" />;
}
export function RelaysTab({ id }: { id: HexKey }) {
const relays = useRelaysFeed(id);
return <RelaysMetadata relays={relays} />;
}
export function BookMarksTab({ id }: { id: HexKey }) {
const bookmarks = useBookmarkList(id);
return <Bookmarks pubkey={id} bookmarks={bookmarks} />;
}

View File

@ -0,0 +1,105 @@
import { FormattedMessage } from "react-intl";
export const FixedModeration = {
/*hateSpeech: {
title: <FormattedMessage defaultMessage="Hate Speech" />,
words: [],
canEdit: false,
},
derogatory: {
title: <FormattedMessage defaultMessage="Derogatory" />,
words: [],
canEdit: false,
},*/
nsfw: {
title: <FormattedMessage defaultMessage="NSFW" id="w6qrwX" />,
words: [
"adult content",
"explicit",
"mature audiences",
"18+",
"sensitive content",
"graphic content",
"age-restricted",
"explicit material",
"adult material",
"nsfw",
"explicit images",
"adult film",
"adult video",
"mature themes",
"sexual content",
"graphic violence",
"strong language",
"explicit language",
"adult-only",
"mature language",
"sex",
],
canEdit: false,
},
crypto: {
title: <FormattedMessage defaultMessage="Crypto" id="TdtZQ5" />,
words: [
"bitcoin",
"btc",
"satoshi",
"crypto",
"blockchain",
"mining",
"wallet",
"exchange",
"halving",
"hash rate",
"ledger",
"crypto trading",
"digital currency",
"virtual currency",
"cryptocurrency investment",
"altcoin",
"decentralized finance",
"defi",
"token",
"ico",
"crypto wallet",
"satoshi nakamoto",
],
canEdit: false,
},
politics: {
title: <FormattedMessage defaultMessage="Politics" id="0siT4z" />,
words: [
"politics",
"election",
"democrat",
"republican",
"senate",
"congress",
"parliament",
"president",
"prime minister",
"policy",
"legislation",
"vote",
"campaign",
"government",
"political party",
"lobbying",
"referendum",
"bill",
"conservative",
"liberal",
"left-wing",
"right-wing",
"socialist",
"capitalist",
"diplomacy",
"sanction",
"geopolitics",
"activism",
"protest",
"rally",
],
canEdit: false,
},
};

View File

@ -0,0 +1,249 @@
import { FormattedMessage } from "react-intl";
export const FixedTopics = {
life: {
text: <FormattedMessage defaultMessage="Life" id="4MjsHk" />,
tags: [
"life",
"lifestyle",
"dailyinspiration",
"motivation",
"lifelessons",
"personaldevelopment",
"happiness",
"wellbeing",
"mindfulness",
"selfcare",
"positivity",
"growth",
"inspiration",
"lifegoals",
"mindset",
"joy",
"balance",
"fulfillment",
"purpose",
"living",
"lifetips",
"lifehacks",
"wellness",
"lifejourney",
"enjoylife",
"simplepleasures",
"gratitude",
"lifeadvice",
"lifecoaching",
"lifelove",
],
},
science: {
text: <FormattedMessage defaultMessage="Science" id="qydxOd" />,
tags: [
"science",
"research",
"innovation",
"technology",
"biology",
"physics",
"chemistry",
"astronomy",
"environment",
"ecology",
"geology",
"neuroscience",
"genetics",
"data",
"experiment",
"theory",
"discovery",
"engineering",
"mathematics",
"robotics",
"artificialintelligence",
"climate",
"space",
"quantum",
"microbiology",
"biotechnology",
"nanotechnology",
"pharmacology",
"astrophysics",
"scientificmethod",
],
},
nature: {
text: <FormattedMessage defaultMessage="Nature" id="1ozeyg" />,
tags: [
"nature",
"wildlife",
"forest",
"mountains",
"rivers",
"oceans",
"flora",
"fauna",
"ecosystem",
"biodiversity",
"conservation",
"habitat",
"landscape",
"outdoors",
"environment",
"geography",
"earth",
"climate",
"naturalbeauty",
"wilderness",
"green",
"sustainability",
"wildlifeconservation",
"nationalpark",
"gardening",
"hiking",
"birdwatching",
"ecotourism",
"photography",
"naturelovers",
],
},
business: {
text: <FormattedMessage defaultMessage="Business" id="w1Fanr" />,
tags: [
"business",
"entrepreneurship",
"marketing",
"finance",
"innovation",
"management",
"startup",
"leadership",
"economics",
"strategy",
"branding",
"sales",
"technology",
"investment",
"networking",
"growth",
"corporate",
"customer",
"market",
"productivity",
"advertising",
"ecommerce",
"analytics",
"humanresources",
"globalbusiness",
"digitalmarketing",
"socialmedia",
"sustainability",
"entrepreneur",
"businessdevelopment",
],
},
game: {
text: <FormattedMessage defaultMessage="Game" id="Am8glJ" />,
tags: [
"gaming",
"videogames",
"esports",
"multiplayer",
"onlinegaming",
"gameplay",
"streaming",
"gamer",
"console",
"pcgaming",
"mobilegaming",
"gamedevelopment",
"virtualreality",
"roleplaying",
"strategygames",
"actiongames",
"simulation",
"indiegames",
"adventuregames",
"puzzle",
"fantasy",
"scifi",
"horror",
"sports",
"racing",
"fighting",
"platformer",
"mmorpg",
"retrogaming",
"arcade",
],
},
sport: {
text: <FormattedMessage defaultMessage="Sport" id="JIVWWA" />,
tags: [
"sports",
"athletics",
"soccer",
"basketball",
"baseball",
"football",
"tennis",
"golf",
"swimming",
"running",
"cycling",
"volleyball",
"hockey",
"skiing",
"boxing",
"martialarts",
"gymnastics",
"cricket",
"rugby",
"tabletennis",
"badminton",
"fishing",
"archery",
"bowling",
"surfing",
"skateboarding",
"motorsports",
"equestrian",
"fitness",
"yoga",
],
},
photography: {
text: <FormattedMessage defaultMessage="Photography" id="cHCwbF" />,
tags: [
"photography",
"landscape",
"portrait",
"naturephotography",
"streetphotography",
"blackandwhite",
"travelphotography",
"macro",
"wildlifephotography",
"urbanphotography",
"nightphotography",
"fashionphotography",
"fineartphotography",
"documentary",
"sportsphotography",
"foodphotography",
"architecturalphotography",
"candid",
"aerialphotography",
"underwaterphotography",
"filmphotography",
"digitalphotography",
"photographytips",
"photoediting",
"photographygear",
"lighting",
"composition",
"exposure",
"photographyworkshop",
"photographyart",
],
},
};

View File

@ -6,113 +6,10 @@ import { useNavigate } from "react-router-dom";
import AsyncButton from "@/Components/Button/AsyncButton";
import { ToggleSwitch } from "@/Components/Icons/Toggle";
import useLogin from "@/Hooks/useLogin";
import { FixedModeration } from "@/Pages/onboarding/fixedModeration";
import { appendDedupe } from "@/Utils";
import { updateAppData } from "@/Utils/Login";
export const FixedModeration = {
/*hateSpeech: {
title: <FormattedMessage defaultMessage="Hate Speech" />,
words: [],
canEdit: false,
},
derogatory: {
title: <FormattedMessage defaultMessage="Derogatory" />,
words: [],
canEdit: false,
},*/
nsfw: {
title: <FormattedMessage defaultMessage="NSFW" id="w6qrwX" />,
words: [
"adult content",
"explicit",
"mature audiences",
"18+",
"sensitive content",
"graphic content",
"age-restricted",
"explicit material",
"adult material",
"nsfw",
"explicit images",
"adult film",
"adult video",
"mature themes",
"sexual content",
"graphic violence",
"strong language",
"explicit language",
"adult-only",
"mature language",
"sex",
],
canEdit: false,
},
crypto: {
title: <FormattedMessage defaultMessage="Crypto" id="TdtZQ5" />,
words: [
"bitcoin",
"btc",
"satoshi",
"crypto",
"blockchain",
"mining",
"wallet",
"exchange",
"halving",
"hash rate",
"ledger",
"crypto trading",
"digital currency",
"virtual currency",
"cryptocurrency investment",
"altcoin",
"decentralized finance",
"defi",
"token",
"ico",
"crypto wallet",
"satoshi nakamoto",
],
canEdit: false,
},
politics: {
title: <FormattedMessage defaultMessage="Politics" id="0siT4z" />,
words: [
"politics",
"election",
"democrat",
"republican",
"senate",
"congress",
"parliament",
"president",
"prime minister",
"policy",
"legislation",
"vote",
"campaign",
"government",
"political party",
"lobbying",
"referendum",
"bill",
"conservative",
"liberal",
"left-wing",
"right-wing",
"socialist",
"capitalist",
"diplomacy",
"sanction",
"geopolitics",
"activism",
"protest",
"rally",
],
canEdit: false,
},
};
export function Moderation() {
const id = useLogin(s => s.id);
const [topics, setTopics] = useState<Array<string>>(Object.keys(FixedModeration));

View File

@ -6,256 +6,9 @@ import { useNavigate } from "react-router-dom";
import AsyncButton from "@/Components/Button/AsyncButton";
import useEventPublisher from "@/Hooks/useEventPublisher";
import { FixedTopics } from "@/Pages/onboarding/fixedTopics";
import { appendDedupe } from "@/Utils";
export const FixedTopics = {
life: {
text: <FormattedMessage defaultMessage="Life" id="4MjsHk" />,
tags: [
"life",
"lifestyle",
"dailyinspiration",
"motivation",
"lifelessons",
"personaldevelopment",
"happiness",
"wellbeing",
"mindfulness",
"selfcare",
"positivity",
"growth",
"inspiration",
"lifegoals",
"mindset",
"joy",
"balance",
"fulfillment",
"purpose",
"living",
"lifetips",
"lifehacks",
"wellness",
"lifejourney",
"enjoylife",
"simplepleasures",
"gratitude",
"lifeadvice",
"lifecoaching",
"lifelove",
],
},
science: {
text: <FormattedMessage defaultMessage="Science" id="qydxOd" />,
tags: [
"science",
"research",
"innovation",
"technology",
"biology",
"physics",
"chemistry",
"astronomy",
"environment",
"ecology",
"geology",
"neuroscience",
"genetics",
"data",
"experiment",
"theory",
"discovery",
"engineering",
"mathematics",
"robotics",
"artificialintelligence",
"climate",
"space",
"quantum",
"microbiology",
"biotechnology",
"nanotechnology",
"pharmacology",
"astrophysics",
"scientificmethod",
],
},
nature: {
text: <FormattedMessage defaultMessage="Nature" id="1ozeyg" />,
tags: [
"nature",
"wildlife",
"forest",
"mountains",
"rivers",
"oceans",
"flora",
"fauna",
"ecosystem",
"biodiversity",
"conservation",
"habitat",
"landscape",
"outdoors",
"environment",
"geography",
"earth",
"climate",
"naturalbeauty",
"wilderness",
"green",
"sustainability",
"wildlifeconservation",
"nationalpark",
"gardening",
"hiking",
"birdwatching",
"ecotourism",
"photography",
"naturelovers",
],
},
business: {
text: <FormattedMessage defaultMessage="Business" id="w1Fanr" />,
tags: [
"business",
"entrepreneurship",
"marketing",
"finance",
"innovation",
"management",
"startup",
"leadership",
"economics",
"strategy",
"branding",
"sales",
"technology",
"investment",
"networking",
"growth",
"corporate",
"customer",
"market",
"productivity",
"advertising",
"ecommerce",
"analytics",
"humanresources",
"globalbusiness",
"digitalmarketing",
"socialmedia",
"sustainability",
"entrepreneur",
"businessdevelopment",
],
},
game: {
text: <FormattedMessage defaultMessage="Game" id="Am8glJ" />,
tags: [
"gaming",
"videogames",
"esports",
"multiplayer",
"onlinegaming",
"gameplay",
"streaming",
"gamer",
"console",
"pcgaming",
"mobilegaming",
"gamedevelopment",
"virtualreality",
"roleplaying",
"strategygames",
"actiongames",
"simulation",
"indiegames",
"adventuregames",
"puzzle",
"fantasy",
"scifi",
"horror",
"sports",
"racing",
"fighting",
"platformer",
"mmorpg",
"retrogaming",
"arcade",
],
},
sport: {
text: <FormattedMessage defaultMessage="Sport" id="JIVWWA" />,
tags: [
"sports",
"athletics",
"soccer",
"basketball",
"baseball",
"football",
"tennis",
"golf",
"swimming",
"running",
"cycling",
"volleyball",
"hockey",
"skiing",
"boxing",
"martialarts",
"gymnastics",
"cricket",
"rugby",
"tabletennis",
"badminton",
"fishing",
"archery",
"bowling",
"surfing",
"skateboarding",
"motorsports",
"equestrian",
"fitness",
"yoga",
],
},
photography: {
text: <FormattedMessage defaultMessage="Photography" id="cHCwbF" />,
tags: [
"photography",
"landscape",
"portrait",
"naturephotography",
"streetphotography",
"blackandwhite",
"travelphotography",
"macro",
"wildlifephotography",
"urbanphotography",
"nightphotography",
"fashionphotography",
"fineartphotography",
"documentary",
"sportsphotography",
"foodphotography",
"architecturalphotography",
"candid",
"aerialphotography",
"underwaterphotography",
"filmphotography",
"digitalphotography",
"photographytips",
"photoediting",
"photographygear",
"lighting",
"composition",
"exposure",
"photographyworkshop",
"photographyart",
],
},
};
export function Topics() {
const { publisher, system } = useEventPublisher();
const [topics, setTopics] = useState<Array<string>>([]);

View File

@ -0,0 +1,12 @@
import { FormattedMessage } from "react-intl";
import messages from "@/Pages/messages";
import { ApiHost } from "@/Utils/Const";
export const SnortNostrAddressService = {
name: "Snort",
service: `${ApiHost}/api/v1/n5sp`,
link: "https://snort.social/",
supportLink: "https://snort.social/help",
about: <FormattedMessage {...messages.SnortSocialNip} />,
};

View File

@ -4,7 +4,7 @@ import Icon from "@/Components/Icons/Icon";
import Nip5Service from "@/Components/Nip5Service";
import Nip05 from "@/Components/User/Nip05";
import { Subscription } from "@/External/SnortApi";
import { SnortNostrAddressService } from "@/Pages/NostrAddressPage";
import { SnortNostrAddressService } from "@/Pages/settings/SnortNostrAddressService";
import { mapPlanName } from "@/Pages/subscribe/utils";
import { RenewSub } from "./RenewSub";

View File

@ -923,7 +923,11 @@ svg.repeat {
}
.pb-safe-area {
padding-bottom: calc(20vh + env(safe-area-inset-bottom));
padding-bottom: env(safe-area-inset-bottom);
}
.pb-safe-area-plus {
padding-bottom: calc(10vh + env(safe-area-inset-bottom));
}
.active > .icon-outline {