diff --git a/client/src/components/modals/CheckMobile/CheckMobile.tsx b/client/src/components/modals/CheckMobile/CheckMobile.tsx index d2691ae..f2dc7a0 100644 --- a/client/src/components/modals/CheckMobile/CheckMobile.tsx +++ b/client/src/components/modals/CheckMobile/CheckMobile.tsx @@ -1,8 +1,6 @@ -import React, { useState, useEffect } from 'react'; -import { XMarkIcon } from "@heroicons/react/24/solid"; -import { ArrowUpOnSquareIcon, PlusCircleIcon } from '@heroicons/react/24/outline'; +import React, { useState, useEffect, Fragment } from 'react'; +import { XMarkIcon, ArrowUpOnSquareIcon, PlusCircleIcon } from "@heroicons/react/24/outline"; import { Dialog, Transition } from '@headlessui/react'; -import { Fragment } from 'react'; declare global { interface Navigator { @@ -10,86 +8,91 @@ declare global { } } -const AddToHomeScreenPrompt: React.FC = () => { +export default function CombinedIntroAndMobile() { + const [showIntro, setShowIntro] = useState(false); const [inMobileBrowser, setInMobileBrowser] = useState(false); useEffect(() => { - const checkPWA = () => { - // Check if the app is running as a PWA on Android - const isAndroidPWA = window.matchMedia('(display-mode: standalone)').matches || - window.matchMedia('(display-mode: minimal-ui)').matches; - - // Check if the app is running as a PWA on other platforms - const isOtherPWA = window.navigator.standalone; - - return !isAndroidPWA && !isOtherPWA; - }; - - // Function to detect mobile browser - const detectMobileBrowser = () => { - return ( - (navigator.userAgent.match(/Android/i) || - navigator.userAgent.match(/webOS/i) || - navigator.userAgent.match(/iPhone/i) || - navigator.userAgent.match(/iPad/i) || - navigator.userAgent.match(/iPod/i) || - navigator.userAgent.match(/Windows Phone/i)) - ); - }; - const timer = setTimeout(() => { - setInMobileBrowser(Boolean(checkPWA() && detectMobileBrowser())); - }, 2000); // 3000 milliseconds = 3 seconds + const hasClosedIntro = localStorage.getItem('hasClosedIntro') !== 'true'; + setShowIntro(hasClosedIntro); + + const checkPWA = () => { + const isAndroidPWA = window.matchMedia('(display-mode: standalone)').matches || + window.matchMedia('(display-mode: minimal-ui)').matches; + const isOtherPWA = window.navigator.standalone; + return !isAndroidPWA && !isOtherPWA; + }; + + const detectMobileBrowser = () => { + return /Android|webOS|iPhone|iPad|iPod|Windows Phone/i.test(navigator.userAgent); + }; + + setInMobileBrowser(checkPWA() && detectMobileBrowser()); + }, 2000); - // Cleanup function to clear the timeout if the component unmounts before the timeout finishes return () => clearTimeout(timer); }, []); - if (!inMobileBrowser) { - return null; - } + const handleClose = () => { + setShowIntro(false); + localStorage.setItem('hasClosedIntro', 'true'); + }; + + if (!showIntro && !inMobileBrowser) return null; return ( - + setInMobileBrowser(false)} + onClose={handleClose} >
- - -
-
- Stay Wired -

Add Wired to your home screen for a better experience

-
    -
  • -
    - {'>'} Click on Share + +
    + {showIntro && ( +
    +

    + Welcome to The Wired + Lain smile +

    +
      +
    • + {'>'} Here your anonymous posts are distributed among a series of independent NOSTR relay servers, + which means they are highly resistant to censorship and moderation. +
    • +
    • + {'>'} Each post must use Proof-of-Work to reduce spam and noise. Your note's ID is a hash of the note, + and this hashing is done repeatedly with a nonce until it starts with multiple leading zeros, + which approximates the work done to generate the note. +
    • +
    -
  • -
  • -
    - {'>'} Click Add to Home Screen + )} + {inMobileBrowser && ( +
    +

    Add Wired to your home screen for a better experience

    +
      +
    • + {'>'} Click on Share +
    • +
    • + {'>'} Click Add to Home Screen +
    • +
    -
  • -
-
- -
+ )} + +
); -}; - -export default AddToHomeScreenPrompt; +} diff --git a/client/src/utils/cardUtils.ts b/client/src/utils/cardUtils.ts index 128a264..e46a11a 100644 --- a/client/src/utils/cardUtils.ts +++ b/client/src/utils/cardUtils.ts @@ -25,6 +25,20 @@ const colorCombos = [ "from-rose-300 to-pink-700", "from-violet-300 to-purple-700", "from-sky-300 to-cyan-700", + "from-fuchsia-300 to-purple-700", + "from-emerald-300 to-teal-700", + "from-slate-300 to-gray-700", + "from-zinc-300 to-slate-700", + "from-stone-300 to-zinc-700", + "from-neutral-300 to-stone-700", + "from-red-300 to-pink-700", + "from-orange-300 to-amber-700", + "from-yellow-300 to-lime-700", + "from-green-300 to-emerald-700", + "from-teal-300 to-cyan-700", + "from-blue-300 to-sky-700", + "from-indigo-300 to-blue-700", + "from-purple-300 to-indigo-700", ]; export const getIconFromHash = (id: string): string => {