From 9add26189b2a7bf0704e691363406f4a4617ba93 Mon Sep 17 00:00:00 2001 From: Stanislav Holts Date: Mon, 26 Feb 2024 22:57:11 +0200 Subject: [PATCH 1/3] refactor(landing): replace landing by thre subscription version --- .../ConfigureWidget/ConfigureWidgetButton.tsx | 15 -- .../ConfigureWidgetCloseButton.tsx | 49 ---- .../ConfigureWidgetContext.tsx | 25 -- .../ConfigureWidget/ConfigureWidgetFrame.tsx | 84 ------- .../ConfigureWidget/close-button.svg | 3 - apps/landing/src/components/Input.tsx | 2 +- apps/landing/src/components/Video/Video.tsx | 2 +- .../src/globalStyles/sliderOverrides.ts | 22 +- apps/landing/src/locales/extractLocale.ts | 15 ++ apps/landing/src/locales/index.ts | 4 + apps/landing/src/locales/locales.ts | 8 + apps/landing/src/locales/translate.ts | 10 + apps/landing/src/locales/translations.ts | 121 ++++++++++ apps/landing/src/pages/+Page.tsx | 29 ++- apps/landing/src/renderer/+config.h.ts | 2 +- apps/landing/src/renderer/+onBeforeRoute.ts | 13 ++ .../landing/src/renderer/+onPrerenderStart.ts | 20 ++ apps/landing/src/renderer/+onRenderHtml.tsx | 40 +--- apps/landing/src/renderer/LocaleText.tsx | 17 ++ apps/landing/src/renderer/fonts.ts | 14 +- apps/landing/src/renderer/types.ts | 8 + apps/landing/src/sections/AddWidget.tsx | 71 ------ apps/landing/src/sections/Cases.tsx | 95 -------- apps/landing/src/sections/Charities.tsx | 176 -------------- apps/landing/src/sections/Contacts.tsx | 90 +++----- apps/landing/src/sections/DocsPanel.tsx | 48 ++++ apps/landing/src/sections/Faq.tsx | 147 +++++++++--- apps/landing/src/sections/HelpIsImportant.tsx | 76 +++++++ apps/landing/src/sections/Home.tsx | 86 +++++-- apps/landing/src/sections/HowItWorks.tsx | 87 ------- apps/landing/src/sections/Impact.tsx | 110 +++++++++ apps/landing/src/sections/LogoPanel.tsx | 80 +++++-- apps/landing/src/sections/Needs.tsx | 83 +++++++ apps/landing/src/sections/Stats.tsx | 16 +- apps/landing/src/sections/Subscriptions.tsx | 215 ++++++++++++++++++ apps/landing/src/sections/Support.tsx | 122 ---------- apps/landing/src/sections/Team.tsx | 139 ----------- apps/landing/src/sections/index.ts | 11 +- apps/landing/vite.config.ts | 1 - .../src/renderer/+onRenderHtml.tsx | 4 - 40 files changed, 1076 insertions(+), 1084 deletions(-) delete mode 100644 apps/landing/src/components/ConfigureWidget/ConfigureWidgetButton.tsx delete mode 100644 apps/landing/src/components/ConfigureWidget/ConfigureWidgetCloseButton.tsx delete mode 100644 apps/landing/src/components/ConfigureWidget/ConfigureWidgetContext.tsx delete mode 100644 apps/landing/src/components/ConfigureWidget/ConfigureWidgetFrame.tsx delete mode 100644 apps/landing/src/components/ConfigureWidget/close-button.svg create mode 100644 apps/landing/src/locales/extractLocale.ts create mode 100644 apps/landing/src/locales/index.ts create mode 100644 apps/landing/src/locales/locales.ts create mode 100644 apps/landing/src/locales/translate.ts create mode 100644 apps/landing/src/locales/translations.ts create mode 100644 apps/landing/src/renderer/+onBeforeRoute.ts create mode 100644 apps/landing/src/renderer/+onPrerenderStart.ts create mode 100644 apps/landing/src/renderer/LocaleText.tsx delete mode 100644 apps/landing/src/sections/AddWidget.tsx delete mode 100644 apps/landing/src/sections/Cases.tsx delete mode 100644 apps/landing/src/sections/Charities.tsx create mode 100644 apps/landing/src/sections/DocsPanel.tsx create mode 100644 apps/landing/src/sections/HelpIsImportant.tsx delete mode 100644 apps/landing/src/sections/HowItWorks.tsx create mode 100644 apps/landing/src/sections/Impact.tsx create mode 100644 apps/landing/src/sections/Needs.tsx create mode 100644 apps/landing/src/sections/Subscriptions.tsx delete mode 100644 apps/landing/src/sections/Support.tsx delete mode 100644 apps/landing/src/sections/Team.tsx diff --git a/apps/landing/src/components/ConfigureWidget/ConfigureWidgetButton.tsx b/apps/landing/src/components/ConfigureWidget/ConfigureWidgetButton.tsx deleted file mode 100644 index 49645770..00000000 --- a/apps/landing/src/components/ConfigureWidget/ConfigureWidgetButton.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { Button } from '../Button'; - -import { ConfigureWidgetContext } from './ConfigureWidgetContext'; - -export default function ConfigureWidgetButton() { - return ( - - {({ setWidgetOpen }) => ( - - )} - - ); -} diff --git a/apps/landing/src/components/ConfigureWidget/ConfigureWidgetCloseButton.tsx b/apps/landing/src/components/ConfigureWidget/ConfigureWidgetCloseButton.tsx deleted file mode 100644 index 9c71261b..00000000 --- a/apps/landing/src/components/ConfigureWidget/ConfigureWidgetCloseButton.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import styled from 'styled-components'; - -import { breakpoints } from '../../helpers'; - -import CloseSVG from './close-button.svg'; -import { ConfigureWidgetContext } from './ConfigureWidgetContext'; - -const CloseButton = styled.a` - position: fixed; - right: 1rem; - top: 4.5rem; - z-index: 11001; - cursor: pointer; - height: 2rem; - width: 2rem; - - & img { - height: 100%; - width: 100%; - } - - ${breakpoints.tablet} and (orientation: portrait) { - top: calc(10% + 4.5rem); - right: 4rem; - height: 2.5rem; - width: 2.5rem; - } - - ${breakpoints.desktop} { - top: calc(10% + 4.5rem); - right: 4rem; - height: 2.5rem; - width: 2.5rem; - } -`; - -export default function ConfigureWidgetCloseButton() { - return ( - - {({ setWidgetOpen, widgetOpen }) => - widgetOpen ? ( - setWidgetOpen(false)}> - Close Button - - ) : null - } - - ); -} diff --git a/apps/landing/src/components/ConfigureWidget/ConfigureWidgetContext.tsx b/apps/landing/src/components/ConfigureWidget/ConfigureWidgetContext.tsx deleted file mode 100644 index d614bbc3..00000000 --- a/apps/landing/src/components/ConfigureWidget/ConfigureWidgetContext.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { createContext, ReactNode, useState } from 'react'; - -export const ConfigureWidgetContext = createContext<{ - widgetOpen: boolean; - setWidgetOpen: React.Dispatch>; -}>({ - widgetOpen: false, - // eslint-disable-next-line @typescript-eslint/no-empty-function - setWidgetOpen: () => {}, -}); - -export function ConfigureWidgetProvider({ children }: { children: ReactNode }) { - const [widgetOpen, setWidgetOpen] = useState(false); - - return ( - - {children} - - ); -} diff --git a/apps/landing/src/components/ConfigureWidget/ConfigureWidgetFrame.tsx b/apps/landing/src/components/ConfigureWidget/ConfigureWidgetFrame.tsx deleted file mode 100644 index eebce2d0..00000000 --- a/apps/landing/src/components/ConfigureWidget/ConfigureWidgetFrame.tsx +++ /dev/null @@ -1,84 +0,0 @@ -import { ReactNode, useEffect, useRef } from 'react'; -import styled, { createGlobalStyle } from 'styled-components'; - -import { breakpoints } from '../../helpers'; - -import ConfigureWidgetCloseButton from './ConfigureWidgetCloseButton'; -import { ConfigureWidgetContext } from './ConfigureWidgetContext'; - -const IFrame = styled.iframe` - flex: 1 0 auto; - background: #fff; - width: 100vw; - height: 100vh; - z-index: 11000; - position: fixed; - top: 0; - left: 0; - - ${breakpoints.tablet} and (orientation: portrait) { - height: 80vh; - top: 10%; - } - - ${breakpoints.desktop} { - height: 80vh; - top: 10%; - } -`; - -const IframeOverlay = styled.div` - display: block; - height: 100vh; - width: 100vw; - z-index: 10050; - background: rgba(0, 0, 0, 0.3); - position: fixed; - left: 0; - top: 0; -`; - -function WidgetWrapper() { - const iframeRef = useRef(null); - - useEffect(() => { - if (iframeRef.current !== null) { - iframeRef.current.scrollIntoView({ - behavior: 'auto', - block: 'center', - inline: 'center', - }); - } - }, [iframeRef]); - - return ( - <> - - -