mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2026-05-05 22:03:16 -04:00
chore: implement unsubscribe from waitlist on landing
This commit is contained in:
@@ -4,12 +4,12 @@ import { loadFull } from 'tsparticles';
|
||||
|
||||
export const Bubbles = () => {
|
||||
const particlesInit = async (main: any) => {
|
||||
console.log(main);
|
||||
// console.log(main);
|
||||
await loadFull(main);
|
||||
};
|
||||
|
||||
const particlesLoaded = (container: any) => {
|
||||
console.log(container);
|
||||
// console.log(container);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
import { Apple, Github, Linux, Windows } from '@icons-pack/react-simple-icons';
|
||||
import { Button, Input } from '@sd/ui';
|
||||
import clsx from 'clsx';
|
||||
import React, { useEffect } from 'react';
|
||||
import { useState } from 'react';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { useSearchParams } from 'react-router-dom';
|
||||
|
||||
import { Info } from '../../../../packages/interface/src/components/icons/Info';
|
||||
import AppEmbed from '../components/AppEmbed';
|
||||
import { Bubbles } from '../components/Bubbles';
|
||||
import { Footer } from '../components/Footer';
|
||||
import HomeCTA from '../components/HomeCTA';
|
||||
import NavBar from '../components/NavBar';
|
||||
import NewBanner from '../components/NewBanner';
|
||||
|
||||
interface SectionProps {
|
||||
orientation: 'left' | 'right';
|
||||
@@ -44,6 +40,29 @@ function Section(props: SectionProps = { orientation: 'left' }) {
|
||||
}
|
||||
|
||||
function Page() {
|
||||
const [searchParams, setSearchParams] = useSearchParams();
|
||||
const [unsubscribedFromWaitlist, setUnsubscribedFromWaitlist] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (!window) return;
|
||||
|
||||
const cuid = searchParams.get('wunsub');
|
||||
if (!cuid) return;
|
||||
|
||||
(async () => {
|
||||
const req = await fetch(`https://waitlist-api.spacedrive.com/api/waitlist?i=${cuid}`, {
|
||||
method: 'DELETE'
|
||||
});
|
||||
|
||||
if (req.status === 200) {
|
||||
setUnsubscribedFromWaitlist(true);
|
||||
window.history.replaceState({}, '', 'https://spacedrive.com/');
|
||||
} else if (req.status >= 400 && req.status < 500) {
|
||||
alert('An error occurred while unsubscribing from waitlist');
|
||||
}
|
||||
})();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="mt-22 lg:mt-28" id="content" aria-hidden="true" />
|
||||
@@ -53,6 +72,17 @@ function Page() {
|
||||
href="https://spacedrive.hashnode.dev/spacedrive-funding-announcement"
|
||||
link="Read post"
|
||||
/> */}
|
||||
{unsubscribedFromWaitlist && (
|
||||
<div
|
||||
className={
|
||||
'-mt-8 flex flex-row items-center bg-opacity-20 border-2 my-2 px-2 rounded-md bg-green-800 border-green-900'
|
||||
}
|
||||
>
|
||||
<Info className="fill-green-500 w-5 mr-1" />
|
||||
<p className={'text-sm text-green-500'}>You have been unsubscribed from the waitlist</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<h1 className="z-30 px-2 mb-3 text-4xl font-black leading-tight text-center fade-in-heading md:text-6xl">
|
||||
A file explorer from the future.
|
||||
</h1>
|
||||
|
||||
Reference in New Issue
Block a user