From 804761fd093be9f39ae584a3360512d0f0af7b5f Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 19 Sep 2023 17:29:24 -0500 Subject: [PATCH 1/3] Move About pages to within the UI --- src/actions/about.ts | 7 ++++--- src/containers/soapbox.tsx | 1 - src/features/about/index.tsx | 12 +++++++----- src/features/public-layout/index.tsx | 2 -- src/features/ui/index.tsx | 3 +++ src/features/ui/util/async-components.ts | 4 ++++ src/instance/about.example/index.html | 4 ++-- 7 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/actions/about.ts b/src/actions/about.ts index 07a486fd21..c8410ded8a 100644 --- a/src/actions/about.ts +++ b/src/actions/about.ts @@ -1,16 +1,17 @@ -import { staticClient } from '../api'; +import api from '../api'; import type { AnyAction } from 'redux'; +import type { RootState } from 'soapbox/store'; const FETCH_ABOUT_PAGE_REQUEST = 'FETCH_ABOUT_PAGE_REQUEST'; const FETCH_ABOUT_PAGE_SUCCESS = 'FETCH_ABOUT_PAGE_SUCCESS'; const FETCH_ABOUT_PAGE_FAIL = 'FETCH_ABOUT_PAGE_FAIL'; -const fetchAboutPage = (slug = 'index', locale?: string) => (dispatch: React.Dispatch) => { +const fetchAboutPage = (slug = 'index', locale?: string) => (dispatch: React.Dispatch, getState: () => RootState) => { dispatch({ type: FETCH_ABOUT_PAGE_REQUEST, slug, locale }); const filename = `${slug}${locale ? `.${locale}` : ''}.html`; - return staticClient.get(`/instance/about/${filename}`) + return api(getState).get(`/instance/about/${filename}`) .then(({ data: html }) => { dispatch({ type: FETCH_ABOUT_PAGE_SUCCESS, slug, locale, html }); return html; diff --git a/src/containers/soapbox.tsx b/src/containers/soapbox.tsx index 92911789dd..811784cbda 100644 --- a/src/containers/soapbox.tsx +++ b/src/containers/soapbox.tsx @@ -110,7 +110,6 @@ const SoapboxMount = () => { )} - {(features.accountCreation && instance.registrations) && ( diff --git a/src/features/about/index.tsx b/src/features/about/index.tsx index 8d1be5c2e0..0112c786a8 100644 --- a/src/features/about/index.tsx +++ b/src/features/about/index.tsx @@ -3,6 +3,7 @@ import { FormattedMessage } from 'react-intl'; import { useParams } from 'react-router-dom'; import { fetchAboutPage } from 'soapbox/actions/about'; +import { Card } from 'soapbox/components/ui'; import { useSoapboxConfig, useSettings, useAppDispatch } from 'soapbox/hooks'; import { languages } from '../preferences'; @@ -60,11 +61,12 @@ const AboutPage: React.FC = () => { ); return ( -
-
- - {alsoAvailable} -
+ +
+
+ {alsoAvailable} +
+ ); }; diff --git a/src/features/public-layout/index.tsx b/src/features/public-layout/index.tsx index 4b5801eb0f..e39bb7508b 100644 --- a/src/features/public-layout/index.tsx +++ b/src/features/public-layout/index.tsx @@ -5,7 +5,6 @@ import LandingGradient from 'soapbox/components/landing-gradient'; import { useAppSelector } from 'soapbox/hooks'; import { isStandalone } from 'soapbox/utils/state'; -import AboutPage from '../about'; import LandingPage from '../landing-page'; import Footer from './components/footer'; @@ -29,7 +28,6 @@ const PublicLayout = () => {
-
diff --git a/src/features/ui/index.tsx b/src/features/ui/index.tsx index cb2da25d19..68b65e19f2 100644 --- a/src/features/ui/index.tsx +++ b/src/features/ui/index.tsx @@ -134,6 +134,7 @@ import { Announcements, EditGroup, FollowedTags, + AboutPage, } from './util/async-components'; import GlobalHotkeys from './util/global-hotkeys'; import { WrappedRoute } from './util/react-router-helpers'; @@ -350,6 +351,8 @@ const SwitchingColumnsArea: React.FC = ({ children }) => + + ); diff --git a/src/features/ui/util/async-components.ts b/src/features/ui/util/async-components.ts index 19a7c3b36a..499883f90d 100644 --- a/src/features/ui/util/async-components.ts +++ b/src/features/ui/util/async-components.ts @@ -1,3 +1,7 @@ +export function AboutPage() { + return import('../../about'); +} + export function EmojiPicker() { return import('../../emoji/components/emoji-picker'); } diff --git a/src/instance/about.example/index.html b/src/instance/about.example/index.html index 6af826f850..6f1a5dc39b 100644 --- a/src/instance/about.example/index.html +++ b/src/instance/about.example/index.html @@ -2,7 +2,7 @@

Your_Instance description

Your_Instance is a way to join the Fediverse, to be part of a community, and to reclaim your freedom of speech in social media.

-

Site rules

+

Site rules

Please refrain from:

  1. Posting anything illegal.
  2. @@ -22,6 +22,6 @@
  3. A bot where all posts are unlisted.
-

Open Source Software

+

Open Source Software

Soapbox is free and open source (FOSS) software.

The Soapbox repository can be found at Soapbox

From 22bb44910278a4399938c53f47185507892b8912 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 19 Sep 2023 17:35:54 -0500 Subject: [PATCH 2/3] Improve about templates --- src/instance/about.example/dmca.html | 2 +- src/instance/about.example/index.html | 5 ++--- src/instance/about.example/privacy.html | 12 +++--------- src/instance/about.example/tos.html | 2 +- 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/instance/about.example/dmca.html b/src/instance/about.example/dmca.html index 516748de83..7e8a236e60 100644 --- a/src/instance/about.example/dmca.html +++ b/src/instance/about.example/dmca.html @@ -1,4 +1,4 @@ -

COPYRIGHT POLICY

+

Copyright Policy

Reporting Claims of Copyright Infringement

We take claims of copyright infringement seriously. We will respond to notices of alleged copyright infringement that comply with applicable law. If you believe any materials accessible on or from this site (the "Website") infringe your copyright, you may request removal of those materials (or access to them) from the Website by submitting written notification to our copyright agent designated below. In accordance with the Online Copyright Infringement Liability Limitation Act of the Digital Millennium Copyright Act (17 U.S.C. § 512) ("DMCA"), the written notice (the "DMCA Notice") must include substantially the following:

diff --git a/src/instance/about.example/index.html b/src/instance/about.example/index.html index 6f1a5dc39b..7974e5374a 100644 --- a/src/instance/about.example/index.html +++ b/src/instance/about.example/index.html @@ -1,6 +1,5 @@ -

About Your_Instance

-

Your_Instance description

-

Your_Instance is a way to join the Fediverse, to be part of a community, and to reclaim your freedom of speech in social media.

+

About Us

+

Join the Fediverse, be part of a community, and to reclaim your freedom online.

Site rules

Please refrain from:

diff --git a/src/instance/about.example/privacy.html b/src/instance/about.example/privacy.html index 2b9869ba26..cf353cdae8 100644 --- a/src/instance/about.example/privacy.html +++ b/src/instance/about.example/privacy.html @@ -1,12 +1,6 @@ -

PRIVACY POLICY

-

Last Updated: Your_Update_Date

- -

Your_Entity_Name ("Company" or "We") respect your privacy and are committed to protecting it through our compliance with this policy.

-

- This policy describes the types of information we may collect from you or that you may provide when you visit the website - Your_Instance_Name - and our practices for collecting, using, maintaining, protecting, and disclosing that information. -

+

Privacy Policy

+

We respect your privacy and are committed to protecting it through our compliance with this policy.

+

This policy describes the types of information we may collect from you or that you may provide when you visit our website, and our practices for collecting, using, maintaining, protecting, and disclosing that information.

This policy applies to information we collect:

On the Website.

In email, text, and other electronic messages between you and this Website.

diff --git a/src/instance/about.example/tos.html b/src/instance/about.example/tos.html index 85464c2828..6569b6cc18 100644 --- a/src/instance/about.example/tos.html +++ b/src/instance/about.example/tos.html @@ -1,9 +1,9 @@ +

Terms of Service

By using this web site, you agree to these Terms of Use, to our Copyright Policy, and to our Privacy Policy.

-

Our Terms of Use are simple:

  • From 25f7771c9303ef69e9c04efdb741dd16f9a9a52d Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 20 Sep 2023 11:21:08 -0500 Subject: [PATCH 3/3] About: add Navlinks to about pages footer --- src/components/navlinks.tsx | 44 ++++++++++++++++++++++++++++++++++++ src/features/about/index.tsx | 17 +++++++++----- 2 files changed, 55 insertions(+), 6 deletions(-) create mode 100644 src/components/navlinks.tsx diff --git a/src/components/navlinks.tsx b/src/components/navlinks.tsx new file mode 100644 index 0000000000..4e08043266 --- /dev/null +++ b/src/components/navlinks.tsx @@ -0,0 +1,44 @@ +import React from 'react'; +import { Link } from 'react-router-dom'; + +import { Text } from 'soapbox/components/ui'; +import { useSettings, useSoapboxConfig } from 'soapbox/hooks'; + +interface INavlinks { + type: string +} + +const Navlinks: React.FC = ({ type }) => { + const settings = useSettings(); + const { copyright, navlinks } = useSoapboxConfig(); + const locale = settings.get('locale') as string; + + return ( +
    +
    + {navlinks.get(type)?.map((link, idx) => { + const url = link.url; + const isExternal = url.startsWith('http'); + const Comp = (isExternal ? 'a' : Link) as 'a'; + const compProps = isExternal ? { href: url, target: '_blank' } : { to: url }; + + return ( +
    + + + {(link.getIn(['titleLocales', locale]) || link.get('title')) as string} + + +
    + ); + })} +
    + +
    + {copyright} +
    +
    + ); +}; + +export { Navlinks }; diff --git a/src/features/about/index.tsx b/src/features/about/index.tsx index 0112c786a8..d2aa40aafc 100644 --- a/src/features/about/index.tsx +++ b/src/features/about/index.tsx @@ -3,6 +3,7 @@ import { FormattedMessage } from 'react-intl'; import { useParams } from 'react-router-dom'; import { fetchAboutPage } from 'soapbox/actions/about'; +import { Navlinks } from 'soapbox/components/navlinks'; import { Card } from 'soapbox/components/ui'; import { useSoapboxConfig, useSettings, useAppDispatch } from 'soapbox/hooks'; @@ -61,12 +62,16 @@ const AboutPage: React.FC = () => { ); return ( - -
    -
    - {alsoAvailable} -
    - +
    + +
    +
    + {alsoAvailable} +
    + + + +
    ); };