📨 The ultimate agentic social media scheduling tool 🤖
TypeScript nextjsopen-sourceopen-source-social-media-scheduling-toolosspostiz-cloudpostiz-hostedredisscheduling-toolsocial-media-scheduling-tooltypescript
feat: delete account from FAQ page
Nevo David3757881e90c0
diff --git a/apps/frontend/src/components/billing/faq.component.tsx b/apps/frontend/src/components/billing/faq.component.tsxindex e47f488e1..5b26316ac 100644--- a/apps/frontend/src/components/billing/faq.component.tsx+++ b/apps/frontend/src/components/billing/faq.component.tsx@@ -1,10 +1,11 @@'use client';-import { FC, useCallback, useState } from 'react';+import { FC, ReactNode, useCallback, useState } from 'react';import clsx from 'clsx';import { useVariables } from '@gitroom/react/helpers/variable.context';import { useUser } from '@gitroom/frontend/components/layout/user.context';import { useT } from '@gitroom/react/translation/get.transation.service.client';+import DeleteAccountComponent from '@gitroom/frontend/components/settings/delete-account.component';const useFaqList = () => {const { isGeneral } = useVariables();const user = useUser();@@ -56,13 +57,31 @@ For example, you can schedule your posts on X, Facebook, Instagram, TikTok, YouT'If you have a team with multiple members, you can invite them to your workspace to collaborate on your posts and add their personal channels'),},+ ...(user?.tier?.current === 'FREE'+ ? [+ {+ title: t(+ 'faq_how_can_i_delete_my_account',+ 'How can I delete my account?'+ ),+ description: t(+ 'faq_delete_account_description',+ `If you don't want to continue using ${+ isGeneral ? 'Postiz' : 'Gitroom'+ }, you can delete your account, including all your organizations, channels and posts. This action cannot be undone.`+ ),+ content: <DeleteAccountComponent isLink={true} />,+ },+ ]+ : []),];};export const FAQSection: FC<{title: string;description: string;+ content?: ReactNode;}> = (props) => {- const { title, description } = props;+ const { title, description, content } = props;const [show, setShow] = useState(false);const changeShow = useCallback(() => {setShow(!show);@@ -123,6 +142,16 @@ export const FAQSection: FC<{__html: description,}}/>+ {content && (+ <div+ onClick={(e) => {+ e.stopPropagation();+ }}+ className="mt-[16px]"+ >+ {content}+ </div>+ )}</div></div>);diff --git a/apps/frontend/src/components/settings/delete-account.component.tsx b/apps/frontend/src/components/settings/delete-account.component.tsxindex f90ea05df..8d6bf939c 100644--- a/apps/frontend/src/components/settings/delete-account.component.tsx+++ b/apps/frontend/src/components/settings/delete-account.component.tsx@@ -1,6 +1,6 @@'use client';-import React, { useCallback, useState } from 'react';+import React, { FC, useCallback, useState } from 'react';import { useFetch } from '@gitroom/helpers/utils/custom.fetch';import { deleteDialog } from '@gitroom/react/helpers/delete.dialog';import { Button } from '@gitroom/react/form/button';@@ -8,8 +8,9 @@ import { useVariables } from '@gitroom/react/helpers/variable.context';import { setCookie } from '@gitroom/frontend/components/layout/layout.context';import { useToaster } from '@gitroom/react/toaster/toaster';import { useT } from '@gitroom/react/translation/get.transation.service.client';+import { TrashIcon } from '@gitroom/frontend/components/ui/icons';-const DeleteAccountComponent = () => {+const DeleteAccountComponent: FC<{ isLink?: boolean }> = ({ isLink }) => {const t = useT();const fetch = useFetch();const toaster = useToaster();@@ -56,22 +57,39 @@ const DeleteAccountComponent = () => {}}, [isSecured]);+ const loadingOverlay = loading && (+ <div className="text-textColor fixed start-0 top-0 bg-primary/80 z-[500] w-full h-full animate-fade flex flex-col items-center justify-center gap-[24px]">+ <div className="w-[48px] h-[48px] border-[3px] border-forth border-t-transparent rounded-full animate-spin" />+ <div className="text-[20px] font-semibold">+ {t('deleting_your_account', 'Deleting your account...')}+ </div>+ <div className="text-[14px] text-textItemBlur">+ {t(+ 'deleting_your_account_description',+ 'We are removing your channels and posts, this can take a while. Please don’t close this window.'+ )}+ </div>+ </div>+ );++ if (isLink) {+ return (+ <>+ {loadingOverlay}+ <div+ className="cursor-pointer flex items-center gap-[8px] text-red-400 hover:text-red-500 text-[14px]"+ onClick={deleteAccount}+ >+ <TrashIcon size={16} />+ <div>{t('delete_account', 'Delete Account')}</div>+ </div>+ </>+ );+ }+return (<div className="my-[16px] mt-[16px] bg-sixth border-fifth border rounded-[4px] p-[24px] flex flex-col gap-[24px]">- {loading && (- <div className="text-textColor fixed start-0 top-0 bg-primary/80 z-[500] w-full h-full animate-fade flex flex-col items-center justify-center gap-[24px]">- <div className="w-[48px] h-[48px] border-[3px] border-forth border-t-transparent rounded-full animate-spin" />- <div className="text-[20px] font-semibold">- {t('deleting_your_account', 'Deleting your account...')}- </div>- <div className="text-[14px] text-textItemBlur">- {t(- 'deleting_your_account_description',- 'We are removing your channels and posts, this can take a while. Please don’t close this window.'- )}- </div>- </div>- )}+ {loadingOverlay}<div className="mt-[4px]">{t('delete_account', 'Delete Account')}</div><div className="flex items-center justify-between"><div className="flex flex-col">