Skip to content

Commit

Permalink
Remove PH Launch Banner
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-gordon committed Aug 30, 2024
1 parent 4712f28 commit a466f22
Show file tree
Hide file tree
Showing 17 changed files with 74 additions and 176 deletions.
74 changes: 2 additions & 72 deletions app/src/components/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint-disable jsx-a11y/no-distracting-elements */
import cx from "classnames";
import { X } from "phosphor-react";
import { memo, ReactNode, Suspense, useState } from "react";
import { memo, ReactNode, Suspense } from "react";
import { Link } from "react-router-dom";

import { useFullscreen, useIsEditorView } from "../lib/hooks";
Expand All @@ -12,15 +11,12 @@ import styles from "./Layout.module.css";
import Loading from "./Loading";
import { VersionCheck } from "./VersionCheck";
import { PaywallModal } from "./PaywallModal";
import { Trans } from "@lingui/macro";

const Layout = memo(({ children }: { children: ReactNode }) => {
const isFullscreen = useFullscreen();
let [showBanner, message, messageType] = getShowBannerAndMessage();
const isEditorView = useIsEditorView();

const [showPHBanner, setShowPHBanner] = useState<boolean>(isPHBannerTime());

// fullscreen disables banners
if (isFullscreen) {
showBanner = false;
Expand All @@ -33,19 +29,8 @@ const Layout = memo(({ children }: { children: ReactNode }) => {
className={styles.LayoutWrapper}
data-showing={isEditorView ? "editor" : undefined}
data-fullscreen={isFullscreen}
data-banner={showBanner || showPHBanner}
data-banner={showBanner}
>
{showPHBanner ? (
<ProductHuntBanner
hide={() => {
setShowPHBanner(false);
// set a cookie to not show the banner again
document.cookie = `showPHBanner=false; path=/; max-age=${
60 * 60 * 24 * 30
}`;
}}
/>
) : null}
{showBanner ? (
<div
className={cx("flex justify-center items-center w-full gap-2", {
Expand Down Expand Up @@ -73,8 +58,6 @@ Layout.displayName = "Layout";

export default Layout;

// ?error=server_error&error_description=Multiple+accounts+with+the+same+email+address+in+the+same+linking+domain+detected%3A+default

function getShowBannerAndMessage(): [boolean, string, "error" | "info"] {
const hash = window.location.hash;
if (hash.startsWith("#message=")) {
Expand All @@ -91,56 +74,3 @@ function getShowBannerAndMessage(): [boolean, string, "error" | "info"] {
}
return [false, "", "info"];
}

/**
* Extremely Temporary Producthunt Banner
*/
export function ProductHuntBanner({ hide }: { hide: () => void }) {
return (
<a
href="https://www.producthunt.com/posts/flowchart-fun-2?embed=true&utm_source=badge-featured&utm_medium=badge&utm_souce=badge-flowchart-fun-2"
target="_blank"
rel="noopener noreferrer"
className="relative bg-gradient-to-b from-orange-400 to-orange-300/80 text-[#443214] hidden md:flex items-center justify-center group"
onClick={hide}
>
<p className="text-sm font-bold pl-4 z-10">
<Trans>
Love Flowchart Fun? Support us with a vote on Product Hunt!
</Trans>
</p>
<div className="w-[64px] h-[52px] overflow-hidden relative mix-blend-multiply rounded-full z-10">
<div className="absolute -top-px -right-px w-[250px] h-[54px]">
<img
src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=483202&theme=neutral"
alt="Flowchart Fun - Text-to-Flowchart with AI Magic 🪄 | Product Hunt"
width={250}
height={54}
/>
</div>
</div>
<div className="absolute top-0 left-0 w-full h-full bg-gradient-to-b from-transparent to-amber-500 hidden group-hover:block animate-pulseIn" />
</a>
);
}

/**
* This function returns true if it's August 25th, 2024, between 12:00am and 11:59pm PST
*/
export function isPHBannerTime() {
// check if the cookie exists
const cookie = document.cookie
.split("; ")
.find((row) => row.startsWith("showPHBanner="));
if (cookie) {
return false;
}

const pstDate = new Date().toLocaleString("en-US", {
timeZone: "America/Los_Angeles",
});
const [date] = pstDate.split(", ");
const [month, day, year] = date.split("/").map(Number);

return year === 2024 && month === 8 && day === 25;
}
2 changes: 1 addition & 1 deletion app/src/locales/de/messages.js

Large diffs are not rendered by default.

20 changes: 8 additions & 12 deletions app/src/locales/de/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ msgstr "Attribute"
msgid "August 2023"
msgstr "August 2023"

#: src/components/LoadTemplateDialog.tsx:100
#: src/components/LoadTemplateDialog.tsx:102
msgid "Back"
msgstr "Zurück"

Expand Down Expand Up @@ -161,7 +161,7 @@ msgstr "Monatlich für $4 berechnet"

#: src/components/Header.tsx:139
#: src/components/Header.tsx:385
#: src/pages/Blog.tsx:28
#: src/pages/Blog.tsx:30
msgid "Blog"
msgstr "Blog"

Expand Down Expand Up @@ -616,8 +616,8 @@ msgstr "Geben Sie unten Ihre E-Mail-Adresse ein, und wir senden Ihnen einen Link
msgid "Equal To"
msgstr "Gleich"

#: src/components/LoadTemplateDialog.tsx:66
#: src/components/LoadTemplateDialog.tsx:82
#: src/components/LoadTemplateDialog.tsx:68
#: src/components/LoadTemplateDialog.tsx:84
msgid "Examples"
msgstr "Beispiele"

Expand Down Expand Up @@ -901,7 +901,7 @@ msgstr "Link"
msgid "Link back"
msgstr "Verlinke zurück"

#: src/components/LoadTemplateDialog.tsx:148
#: src/components/LoadTemplateDialog.tsx:150
msgid "Load"
msgstr "Laden"

Expand All @@ -917,15 +917,15 @@ msgstr "Datei laden"
msgid "Load Files"
msgstr "Dateien laden"

#: src/components/LoadTemplateDialog.tsx:120
#: src/components/LoadTemplateDialog.tsx:122
msgid "Load default content"
msgstr "Standardinhalt laden"

#: src/components/LoadFromHashDialog.tsx:36
msgid "Load from link?"
msgstr "Von Link laden?"

#: src/components/LoadTemplateDialog.tsx:113
#: src/components/LoadTemplateDialog.tsx:115
msgid "Load layout and styles"
msgstr "Layout und Stile laden"

Expand Down Expand Up @@ -960,10 +960,6 @@ msgstr "Einloggen, um zu speichern"
msgid "Log in to upgrade your account"
msgstr "Melde dich an, um dein Konto zu aktualisieren"

#: src/components/Layout.tsx:108
msgid "Love Flowchart Fun? Support us with a vote on Product Hunt!"
msgstr "Liebst du den Flowchart Spaß? Unterstütze uns mit einer Stimme auf Product Hunt!"

#: src/components/Settings.tsx:151
msgid "Make a One-Time Donation"
msgstr "Machen Sie eine einmalige Spende"
Expand Down Expand Up @@ -1556,7 +1552,7 @@ msgstr "Dies kann je nach Länge Ihrer Eingabe zwischen 30 Sekunden und 2 Minute
msgid "This sandbox is perfect for experimenting, but remember - it resets daily. Upgrade now and keep your current work!"
msgstr "Diese Sandbox ist perfekt zum Experimentieren, aber denk daran - sie wird täglich zurückgesetzt. Upgrade jetzt und behalte deine aktuelle Arbeit!"

#: src/components/LoadTemplateDialog.tsx:134
#: src/components/LoadTemplateDialog.tsx:136
msgid "This will replace the current content."
msgstr "Dies ersetzt den aktuellen Inhalt."

Expand Down
2 changes: 1 addition & 1 deletion app/src/locales/en/messages.js

Large diffs are not rendered by default.

20 changes: 8 additions & 12 deletions app/src/locales/en/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ msgstr "Attributes"
msgid "August 2023"
msgstr "August 2023"

#: src/components/LoadTemplateDialog.tsx:100
#: src/components/LoadTemplateDialog.tsx:102
msgid "Back"
msgstr "Back"

Expand Down Expand Up @@ -161,7 +161,7 @@ msgstr "Billed monthly at $4"

#: src/components/Header.tsx:139
#: src/components/Header.tsx:385
#: src/pages/Blog.tsx:28
#: src/pages/Blog.tsx:30
msgid "Blog"
msgstr "Blog"

Expand Down Expand Up @@ -616,8 +616,8 @@ msgstr "Enter your email address below and we'll send you a link to reset your p
msgid "Equal To"
msgstr "Equal To"

#: src/components/LoadTemplateDialog.tsx:66
#: src/components/LoadTemplateDialog.tsx:82
#: src/components/LoadTemplateDialog.tsx:68
#: src/components/LoadTemplateDialog.tsx:84
msgid "Examples"
msgstr "Examples"

Expand Down Expand Up @@ -901,7 +901,7 @@ msgstr "Link"
msgid "Link back"
msgstr "Link back"

#: src/components/LoadTemplateDialog.tsx:148
#: src/components/LoadTemplateDialog.tsx:150
msgid "Load"
msgstr "Load"

Expand All @@ -917,15 +917,15 @@ msgstr "Load File"
msgid "Load Files"
msgstr "Load Files"

#: src/components/LoadTemplateDialog.tsx:120
#: src/components/LoadTemplateDialog.tsx:122
msgid "Load default content"
msgstr "Load default content"

#: src/components/LoadFromHashDialog.tsx:36
msgid "Load from link?"
msgstr "Load from link?"

#: src/components/LoadTemplateDialog.tsx:113
#: src/components/LoadTemplateDialog.tsx:115
msgid "Load layout and styles"
msgstr "Load layout and styles"

Expand Down Expand Up @@ -960,10 +960,6 @@ msgstr "Log in to Save"
msgid "Log in to upgrade your account"
msgstr "Log in to upgrade your account"

#: src/components/Layout.tsx:108
msgid "Love Flowchart Fun? Support us with a vote on Product Hunt!"
msgstr "Love Flowchart Fun? Support us with a vote on Product Hunt!"

#: src/components/Settings.tsx:151
msgid "Make a One-Time Donation"
msgstr "Make a One-Time Donation"
Expand Down Expand Up @@ -1556,7 +1552,7 @@ msgstr "This may take between 30 seconds and 2 minutes depending on the length o
msgid "This sandbox is perfect for experimenting, but remember - it resets daily. Upgrade now and keep your current work!"
msgstr "This sandbox is perfect for experimenting, but remember - it resets daily. Upgrade now and keep your current work!"

#: src/components/LoadTemplateDialog.tsx:134
#: src/components/LoadTemplateDialog.tsx:136
msgid "This will replace the current content."
msgstr "This will replace the current content."

Expand Down
2 changes: 1 addition & 1 deletion app/src/locales/es/messages.js

Large diffs are not rendered by default.

20 changes: 8 additions & 12 deletions app/src/locales/es/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ msgstr "Atributos"
msgid "August 2023"
msgstr "Agosto 2023"

#: src/components/LoadTemplateDialog.tsx:100
#: src/components/LoadTemplateDialog.tsx:102
msgid "Back"
msgstr "Atrás"

Expand Down Expand Up @@ -161,7 +161,7 @@ msgstr "Facturado mensualmente a $4"

#: src/components/Header.tsx:139
#: src/components/Header.tsx:385
#: src/pages/Blog.tsx:28
#: src/pages/Blog.tsx:30
msgid "Blog"
msgstr "Blog"

Expand Down Expand Up @@ -616,8 +616,8 @@ msgstr "Ingresa tu dirección de correo electrónico a continuación y te enviar
msgid "Equal To"
msgstr "Igual a"

#: src/components/LoadTemplateDialog.tsx:66
#: src/components/LoadTemplateDialog.tsx:82
#: src/components/LoadTemplateDialog.tsx:68
#: src/components/LoadTemplateDialog.tsx:84
msgid "Examples"
msgstr "Ejemplos"

Expand Down Expand Up @@ -901,7 +901,7 @@ msgstr "Enlace"
msgid "Link back"
msgstr "Volver al enlace"

#: src/components/LoadTemplateDialog.tsx:148
#: src/components/LoadTemplateDialog.tsx:150
msgid "Load"
msgstr "Cargar"

Expand All @@ -917,15 +917,15 @@ msgstr "Cargar archivo"
msgid "Load Files"
msgstr "Cargar archivos"

#: src/components/LoadTemplateDialog.tsx:120
#: src/components/LoadTemplateDialog.tsx:122
msgid "Load default content"
msgstr "Cargar contenido predeterminado"

#: src/components/LoadFromHashDialog.tsx:36
msgid "Load from link?"
msgstr "¿Cargar desde el enlace?"

#: src/components/LoadTemplateDialog.tsx:113
#: src/components/LoadTemplateDialog.tsx:115
msgid "Load layout and styles"
msgstr "Cargar diseño y estilos"

Expand Down Expand Up @@ -960,10 +960,6 @@ msgstr "Inicia sesión para guardar"
msgid "Log in to upgrade your account"
msgstr "Iniciar sesión para actualizar tu cuenta"

#: src/components/Layout.tsx:108
msgid "Love Flowchart Fun? Support us with a vote on Product Hunt!"
msgstr "¿Te gusta Love Flowchart Fun? ¡Apóyanos con un voto en Product Hunt!"

#: src/components/Settings.tsx:151
msgid "Make a One-Time Donation"
msgstr "Realizar una donación única"
Expand Down Expand Up @@ -1556,7 +1552,7 @@ msgstr "Esto puede tardar entre 30 segundos y 2 minutos dependiendo de la longit
msgid "This sandbox is perfect for experimenting, but remember - it resets daily. Upgrade now and keep your current work!"
msgstr "Esta caja de arena es perfecta para experimentar, pero recuerda: se reinicia diariamente. ¡Actualiza ahora y guarda tu trabajo actual!"

#: src/components/LoadTemplateDialog.tsx:134
#: src/components/LoadTemplateDialog.tsx:136
msgid "This will replace the current content."
msgstr "Esto reemplazará el contenido actual."

Expand Down
2 changes: 1 addition & 1 deletion app/src/locales/fr/messages.js

Large diffs are not rendered by default.

Loading

0 comments on commit a466f22

Please sign in to comment.