A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.
feat(app): add donate link, hide unset terms and privacy links
Hampus07e67b7869f7
diff --git a/fluxer_app/src/features/app/components/dialogs/components/DesktopSettingsView.tsx b/fluxer_app/src/features/app/components/dialogs/components/DesktopSettingsView.tsxindex 7a4d537ca..2ed0210d1 100644--- a/fluxer_app/src/features/app/components/dialogs/components/DesktopSettingsView.tsx+++ b/fluxer_app/src/features/app/components/dialogs/components/DesktopSettingsView.tsx@@ -27,6 +27,7 @@ import {} from '@app/features/app/components/dialogs/shared/SettingsModalLayout';import {BACK_TO_SETTINGS_DESCRIPTOR,+ DONATE_DESCRIPTOR,OPENS_IN_BROWSER_DESCRIPTOR,SEARCH_SETTINGS_PLACEHOLDER_DESCRIPTOR,SIGN_OUT_DESCRIPTOR,@@ -40,6 +41,7 @@ import * as ModalCommands from '@app/features/ui/commands/ModalCommands';import {modal} from '@app/features/ui/commands/ModalCommands';import {MentionBadgeAnimated} from '@app/features/ui/components/MentionBadge';import {StatusAwareAvatar} from '@app/features/ui/components/StatusAwareAvatar';+import {ArrowLeftIcon, ArrowRightIcon, CaretRightIcon} from '@app/features/ui/icons/DirectionalIcons';import SettingsSidebar from '@app/features/ui/state/SettingsSidebar';import {openExternalUrl} from '@app/features/ui/utils/NativeUtils';import {@@ -94,15 +96,7 @@ import {} from '@app/features/user/utils/SettingsModalLayoutUtils';import type {I18n} from '@lingui/core';import {Trans, useLingui} from '@lingui/react/macro';-import {- ArrowLeftIcon,- ArrowRightIcon,- ArrowSquareOutIcon,- CaretRightIcon,- ChatCircleDotsIcon,- SignOutIcon,- SparkleIcon,-} from '@phosphor-icons/react';+import {ArrowSquareOutIcon, ChatCircleDotsIcon, HandHeartIcon, SignOutIcon, SparkleIcon} from '@phosphor-icons/react';import {clsx} from 'clsx';import {AnimatePresence, motion} from 'framer-motion';import {observer} from 'mobx-react-lite';@@ -378,6 +372,7 @@ export const DesktopSettingsView: React.FC<DesktopSettingsViewProps> = observer(};const patchNotesUrl = Routes.patchNotes();const feedbackUrl = Routes.feedback();+ const donateUrl = Routes.donate();const handleTabSelect = (tabType: UserSettingsTabType) => {if (checkUnsavedChanges()) return;onTabSelect(tabType);@@ -431,19 +426,24 @@ export const DesktopSettingsView: React.FC<DesktopSettingsViewProps> = observer(const applicationsTabLabel = getUserSettingsTabLabel(i18n, 'applications');const applicationDetailTitle =ApplicationsTabState.selectedApplication?.name ?? i18n._(APPLICATION_DETAILS_DESCRIPTOR);- const desktopTitle = isSearchActive ? (- i18n._(SEARCH_RESULTS_DESCRIPTOR)- ) : isApplicationsDetailTitle ? (- <BreadcrumbTitle- parentLabel={applicationsTabLabel}- currentLabel={applicationDetailTitle}- onParentClick={handleApplicationsBreadcrumbClick}- parentDataFlx="app.desktop-settings-view.breadcrumb-button.applications"- data-flx="app.desktop-settings-view.breadcrumb-title"- />- ) : (- currentTab?.label || i18n._(USER_SETTINGS_LABEL_DESCRIPTOR)- );+ let desktopTitle: React.ReactNode;+ if (isSearchActive) {+ desktopTitle = i18n._(SEARCH_RESULTS_DESCRIPTOR);+ } else if (isApplicationsDetailTitle) {+ desktopTitle = (+ <BreadcrumbTitle+ parentLabel={applicationsTabLabel}+ currentLabel={applicationDetailTitle}+ onParentClick={handleApplicationsBreadcrumbClick}+ parentDataFlx="app.desktop-settings-view.breadcrumb-button.applications"+ data-flx="app.desktop-settings-view.breadcrumb-title"+ />+ );+ } else {+ desktopTitle = currentTab?.label || i18n._(USER_SETTINGS_LABEL_DESCRIPTOR);+ }+ const termsUrl = Routes.terms();+ const privacyUrl = Routes.privacy();const sidebarFooter = (<AnimatePresence data-flx="app.desktop-settings-view.animate-presence">{!useOverride && (@@ -457,26 +457,32 @@ export const DesktopSettingsView: React.FC<DesktopSettingsViewProps> = observer(<SettingsModalSidebarFooter data-flx="app.desktop-settings-view.settings-modal-sidebar-footer"><div className={styles.footerContent} data-flx="app.desktop-settings-view.footer-content"><ClientInfo data-flx="app.desktop-settings-view.client-info" />- <div className={styles.legalLinks} data-flx="app.desktop-settings-view.legal-links">- <a- href={Routes.terms()}- target="_blank"- rel="noopener noreferrer"- className={styles.legalLink}- data-flx="app.desktop-settings-view.legal-link"- >- <Trans>Terms of service</Trans>- </a>- <a- href={Routes.privacy()}- target="_blank"- rel="noopener noreferrer"- className={styles.legalLink}- data-flx="app.desktop-settings-view.legal-link--2"- >- <Trans>Privacy policy</Trans>- </a>- </div>+ {termsUrl || privacyUrl ? (+ <div className={styles.legalLinks} data-flx="app.desktop-settings-view.legal-links">+ {termsUrl ? (+ <a+ href={termsUrl}+ target="_blank"+ rel="noopener noreferrer"+ className={styles.legalLink}+ data-flx="app.desktop-settings-view.legal-link"+ >+ <Trans>Terms of service</Trans>+ </a>+ ) : null}+ {privacyUrl ? (+ <a+ href={privacyUrl}+ target="_blank"+ rel="noopener noreferrer"+ className={styles.legalLink}+ data-flx="app.desktop-settings-view.legal-link--2"+ >+ <Trans>Privacy policy</Trans>+ </a>+ ) : null}+ </div>+ ) : null}<div className={styles.footerSpacer} data-flx="app.desktop-settings-view.footer-spacer" /></div></SettingsModalSidebarFooter>@@ -674,6 +680,20 @@ export const DesktopSettingsView: React.FC<DesktopSettingsViewProps> = observer(data-flx="app.desktop-settings-view.settings-modal-sidebar-item.submit-feedback"/>)}+ {donateUrl && (+ <SettingsModalSidebarItem+ icon={HandHeartIcon}+ label={+ <ExternalSidebarItemLabel+ label={i18n._(DONATE_DESCRIPTOR)}+ hint={i18n._(OPENS_IN_BROWSER_DESCRIPTOR)}+ data-flx="app.desktop-settings-view.donate-label"+ />+ }+ onClick={() => void openExternalUrl(donateUrl)}+ data-flx="app.desktop-settings-view.settings-modal-sidebar-item.donate"+ />+ )}<SettingsModalSidebarItemicon={SignOutIcon}label={i18n._(SIGN_OUT_DESCRIPTOR)}diff --git a/fluxer_app/src/features/app/components/dialogs/components/MobileSettingsView.tsx b/fluxer_app/src/features/app/components/dialogs/components/MobileSettingsView.tsxindex 909ad2a0c..bf31327de 100644--- a/fluxer_app/src/features/app/components/dialogs/components/MobileSettingsView.tsx+++ b/fluxer_app/src/features/app/components/dialogs/components/MobileSettingsView.tsx@@ -15,6 +15,7 @@ import {SETTINGS_FADE_VARIANTS} from '@app/features/app/components/dialogs/shareimport {LongPressable} from '@app/features/app/components/LongPressable';import {usePressable} from '@app/features/app/hooks/usePressable';import {+ DONATE_DESCRIPTOR,OPENS_IN_BROWSER_DESCRIPTOR,SETTINGS_DESCRIPTOR,SIGN_OUT_DESCRIPTOR,@@ -32,6 +33,8 @@ import {NotificationDot} from '@app/features/ui/components/NotificationDot';import {Scroller, type ScrollerHandle} from '@app/features/ui/components/Scroller';import {Spinner} from '@app/features/ui/components/Spinner';import {StatusAwareAvatar} from '@app/features/ui/components/StatusAwareAvatar';+import {ArrowLeftIcon} from '@app/features/ui/icons/DirectionalIcons';+import {useToastAnchor} from '@app/features/ui/toast/ToastAnchor';import {openExternalUrl} from '@app/features/ui/utils/NativeUtils';import ApplicationsTabState from '@app/features/user/components/modals/tabs/applications_tab/ApplicationsTabState';import userSettingsStyles from '@app/features/user/components/modals/UserSettingsModal.module.css';@@ -60,9 +63,9 @@ import {msg} from '@lingui/core/macro';import {useLingui} from '@lingui/react/macro';import {ArrowClockwiseIcon,- ArrowLeftIcon,ArrowSquareOutIcon,ChatCircleDotsIcon,+ HandHeartIcon,type IconWeight,SignOutIcon,SparkleIcon,@@ -420,6 +423,7 @@ const MobileSettingsList = observer(}, []);const patchNotesUrl = Routes.patchNotes();const feedbackUrl = Routes.feedback();+ const donateUrl = Routes.donate();const categories = Object.entries(mobileVisibleTabs);const lastCategoryIndex = categories.length - 1;return (@@ -454,18 +458,22 @@ const MobileSettingsList = observer({tabs.map((tab, index) => {const isLastTab = index === tabs.length - 1;const isLastCategory = categoryIndex === lastCategoryIndex;- const badge =- tab.type === 'gift_inventory' && currentUser?.hasUnreadGiftInventory ? (+ let badge: React.ReactNode;+ if (tab.type === 'gift_inventory' && currentUser?.hasUnreadGiftInventory) {+ badge = (<MentionBadgeAnimatedmentionCount={currentUser.unreadGiftInventoryCount ?? 1}data-flx="app.mobile-settings-view.mobile-settings-list.mention-badge-animated"/>- ) : tab.type === 'advanced_settings' && advancedSettingsHasNew ? (+ );+ } else if (tab.type === 'advanced_settings' && advancedSettingsHasNew) {+ badge = (<SettingsStatusBadgekind="new"data-flx="app.mobile-settings-view.mobile-settings-list.settings-status-badge"/>- ) : undefined;+ );+ }return (<div key={tab.type} data-flx="app.mobile-settings-view.mobile-settings-list.div"><PressableSettingsItem@@ -514,6 +522,19 @@ const MobileSettingsList = observer(<div className={styles.divider} data-flx="app.mobile-settings-view.mobile-settings-list.divider--3" /></>)}+ {categoryIndex === lastCategoryIndex && donateUrl && (+ <>+ <MobileSettingsActionItem+ icon={HandHeartIcon}+ iconWeight="fill"+ label={i18n._(DONATE_DESCRIPTOR)}+ onClick={() => void openExternalUrl(donateUrl)}+ external={true}+ data-flx="app.mobile-settings-view.mobile-settings-list.mobile-settings-action-item.donate"+ />+ <div className={styles.divider} data-flx="app.mobile-settings-view.mobile-settings-list.divider--4" />+ </>+ )}{categoryIndex === lastCategoryIndex && (<MobileSettingsDangerItemicon={SignOutIcon}@@ -678,6 +699,8 @@ export const MobileSettingsView: React.FC<MobileSettingsViewProps> = observer(currentTabId && !(currentTabId === 'applications' && ApplicationsTabState.isDetailView)? buildUserSettingsDeepLink(currentTabId): null;+ const headerRef = useRef<HTMLDivElement>(null);+ useToastAnchor(headerRef);const listScrollPositionRef = useRef(0);const listScrollerRef = useRef<ScrollerHandle | null>(null);const handleListScroll = useCallback((event: UIEvent<HTMLDivElement>) => {@@ -694,7 +717,11 @@ export const MobileSettingsView: React.FC<MobileSettingsViewProps> = observer(const currentTabComponent = currentTab ? getSettingsTabComponent(currentTab.type) : null;return (<div className={userSettingsStyles.mobileWrapper} data-flx="app.mobile-settings-view.div">- <div className={userSettingsStyles.mobileHeaderContainer} data-flx="app.mobile-settings-view.div--2">+ <div+ ref={headerRef}+ className={userSettingsStyles.mobileHeaderContainer}+ data-flx="app.mobile-settings-view.div--2"+ ><AnimatePresencemode="wait"custom={mobileNav.direction}