From cb17cead0ff9f80cf4406f48780a6289bbff46f2 Mon Sep 17 00:00:00 2001 From: florian <> Date: Fri, 8 Mar 2024 20:19:56 +0000 Subject: [PATCH] chore: cleanup --- .env.sample | 1 + src/App.tsx | 3 ++- src/components/AuthorProfile/AuthorProfile.tsx | 2 +- src/components/Home/index.tsx | 4 ++-- src/components/Layout/Layout.tsx | 5 ++--- src/components/SlideShow.tsx | 2 +- src/components/env.ts | 2 ++ 7 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.env.sample b/.env.sample index 173e596..2d37424 100644 --- a/.env.sample +++ b/.env.sample @@ -1,2 +1,3 @@ VITE_APP_NAME=slidestr.net +VITE_PUBLIC_URL=https://slidestr.net VITE_IMAGE_PROXY=https://imgproxy.slidestr.net diff --git a/src/App.tsx b/src/App.tsx index 8d581fe..83cce56 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -10,12 +10,13 @@ import Layout from './components/Layout/Layout'; import SlideShow from './components/SlideShow'; const cacheAdapterDexie = new NDKCacheAdapterDexie({ dbName: 'slidestr' }); + const ndk = new NDK({ explicitRelayUrls: defaultRelays, outboxRelayUrls: ['wss://purplepag.es'], enableOutboxModel: true, // eslint-disable-next-line @typescript-eslint/no-explicit-any - cacheAdapter: cacheAdapterDexie as any, // types don't in the current version + cacheAdapter: cacheAdapterDexie as any, // types don't match in the current version }); const App = () => { diff --git a/src/components/AuthorProfile/AuthorProfile.tsx b/src/components/AuthorProfile/AuthorProfile.tsx index 25dc925..b2092d9 100644 --- a/src/components/AuthorProfile/AuthorProfile.tsx +++ b/src/components/AuthorProfile/AuthorProfile.tsx @@ -29,7 +29,7 @@ const AuthorProfile = ({ const avatarLoaded = useImageLoaded(src); const { nav, currentSettings } = useNav(); const session = useSession(); - + const followButtonAvailable = followButton && session?.pubkey; return ( diff --git a/src/components/Home/index.tsx b/src/components/Home/index.tsx index e9c7678..61d6b88 100644 --- a/src/components/Home/index.tsx +++ b/src/components/Home/index.tsx @@ -1,4 +1,4 @@ -import { topics } from '../env'; +import { publicUrl, topics } from '../env'; import useNav from '../../utils/useNav'; import './Home.css'; import usePeopleLists from '../../utils/useLists'; @@ -35,7 +35,7 @@ const Home = () => { key={tk} className="topic" style={{ - backgroundImage: `linear-gradient(170deg, rgba(0, 0, 0, .8) 0%, rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0) 100%), url(${createImgProxyUrl('https://slidestr.net/images/' + tk + '.jpg', 600, -1)})`, + backgroundImage: `linear-gradient(170deg, rgba(0, 0, 0, .8) 0%, rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0) 100%), url(${createImgProxyUrl(publicUrl + '/images/' + tk + '.jpg', 600, -1)})`, }} onClick={() => nav({ ...currentSettings, topic: tk, npubs: [], tags: [], list: undefined, follows: false, showAdult }) diff --git a/src/components/Layout/Layout.tsx b/src/components/Layout/Layout.tsx index 5ee5f4f..ca429bd 100644 --- a/src/components/Layout/Layout.tsx +++ b/src/components/Layout/Layout.tsx @@ -15,8 +15,8 @@ const Layout = () => { const [showLogin, setShowLogin] = useState(false); const logOut = useLogOut(); const session = useSession(); - - const profile = useProfile(session?.pubkey || '', NDKSubscriptionCacheUsage.CACHE_FIRST); + + const profile = useProfile(session?.pubkey || '', NDKSubscriptionCacheUsage.CACHE_FIRST); // useEffect(() => { // if (currentSettings.npubs.length == 0 && currentSettings.tags.length == 0) { @@ -28,7 +28,6 @@ const Layout = () => { logOut(); }; - return ( <> {showLogin && setShowLogin(false)} />} diff --git a/src/components/SlideShow.tsx b/src/components/SlideShow.tsx index ad1c0fc..cf66e65 100644 --- a/src/components/SlideShow.tsx +++ b/src/components/SlideShow.tsx @@ -90,7 +90,7 @@ const SlideShow = () => { const session = useSession(); const profile = useProfile(session?.pubkey || ' '); - const userNPub = session ? nip19.npubEncode(session?.pubkey) as string : undefined; + const userNPub = session ? (nip19.npubEncode(session?.pubkey) as string) : undefined; const { zapClick, heartClick, zapState, heartState, repostClick, repostState } = useZapsAndReations( state.activeImage, diff --git a/src/components/env.ts b/src/components/env.ts index e8fa960..317d636 100644 --- a/src/components/env.ts +++ b/src/components/env.ts @@ -4,6 +4,8 @@ export const imageProxy = import.meta.env.VITE_IMAGE_PROXY || 'https://imgproxy. export const appName = import.meta.env.VITE_APP_NAME || 'slidestr.net'; +export const publicUrl = import.meta.env.VITE_PUBLIC_URL || 'https://slidestr.net'; + type Topic = { name?: string; tags: string[];