Updates Wrapstodon footer with dedicated local server info (#37270)

This commit is contained in:
diondiondion
2025-12-16 16:35:26 +01:00
committed by GitHub
parent 7e81e03531
commit e6b0cdcc83
6 changed files with 78 additions and 38 deletions

View File

@@ -10,6 +10,7 @@ module WrapstodonHelper
).as_json ).as_json
payload[:me] = current_account.id.to_s if user_signed_in? payload[:me] = current_account.id.to_s if user_signed_in?
payload[:domain] = Addressable::IDNA.to_unicode(Rails.configuration.x.local_domain)
json_string = payload.to_json json_string = payload.to_json

View File

@@ -25,7 +25,7 @@ function loaded() {
const initialState = JSON.parse( const initialState = JSON.parse(
propsNode.textContent, propsNode.textContent,
) as ApiAnnualReportResponse & { me?: string }; ) as ApiAnnualReportResponse & { me?: string; domain: string };
const report = initialState.annual_reports[0]; const report = initialState.annual_reports[0];
if (!report) { if (!report) {
@@ -38,6 +38,7 @@ function loaded() {
meta: { meta: {
locale: document.documentElement.lang, locale: document.documentElement.lang,
me: initialState.me, me: initialState.me,
domain: initialState.domain,
}, },
accounts: initialState.accounts, accounts: initialState.accounts,
}), }),

View File

@@ -27,7 +27,7 @@ import { NewPosts } from './new_posts';
const moduleClassNames = classNames.bind(styles); const moduleClassNames = classNames.bind(styles);
const accountSelector = createAppSelector( export const accountSelector = createAppSelector(
[(state) => state.accounts, (state) => state.annualReport.report], [(state) => state.accounts, (state) => state.annualReport.report],
(accounts, report) => { (accounts, report) => {
if (report?.schema_version === 2) { if (report?.schema_version === 2) {

View File

@@ -16,22 +16,16 @@ $mobile-breakpoint: 540px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
gap: 0.75rem; gap: 1.8rem;
margin-top: 2rem; margin-top: 2rem;
font-size: 16px; font-size: 16px;
line-height: 1.4;
text-align: center; text-align: center;
color: var(--color-text-secondary); color: var(--color-text-secondary);
}
.logo { strong {
width: 2rem; font-weight: 600;
opacity: 0.6; }
}
.nav {
display: flex;
flex-wrap: wrap;
gap: 12px;
a:any-link { a:any-link {
color: inherit; color: inherit;
@@ -43,3 +37,22 @@ $mobile-breakpoint: 540px;
color: var(--color-text-primary); color: var(--color-text-primary);
} }
} }
.logo {
width: 2rem;
opacity: 0.6;
}
.footerSection {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.5rem;
}
.linkList {
list-style: none;
display: flex;
flex-wrap: wrap;
gap: 12px;
}

View File

@@ -2,43 +2,66 @@ import type { FC } from 'react';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import { DisplayName } from '@/mastodon/components/display_name';
import { IconLogo } from '@/mastodon/components/logo'; import { IconLogo } from '@/mastodon/components/logo';
import { useAppSelector } from '@/mastodon/store'; import { useAppSelector } from '@/mastodon/store';
import { AnnualReport } from './index'; import { AnnualReport, accountSelector } from './index';
import classes from './shared_page.module.scss'; import classes from './shared_page.module.scss';
export const WrapstodonSharedPage: FC = () => { export const WrapstodonSharedPage: FC = () => {
const isLoggedIn = useAppSelector((state) => !!state.meta.get('me')); const account = useAppSelector(accountSelector);
const domain = useAppSelector((state) => state.meta.get('domain') as string);
return ( return (
<main className={classes.wrapper}> <main className={classes.wrapper}>
<AnnualReport /> <AnnualReport />
<footer className={classes.footer}> <footer className={classes.footer}>
<IconLogo className={classes.logo} /> <div className={classes.footerSection}>
<FormattedMessage <IconLogo className={classes.logo} />
id='annual_report.shared_page.footer' <FormattedMessage
defaultMessage='Generated with {heart} by the Mastodon team' id='annual_report.shared_page.footer'
values={{ heart: '🐘' }} defaultMessage='Generated with {heart} by the Mastodon team'
/> values={{ heart: '🐘' }}
<nav className={classes.nav}> tagName='p'
<a href='https://joinmastodon.org'> />
<FormattedMessage id='footer.about' defaultMessage='About' /> <ul className={classes.linkList}>
</a> <li>
{!isLoggedIn && ( <a href='https://joinmastodon.org'>
<a href='https://joinmastodon.org/servers'> <FormattedMessage
<FormattedMessage id='footer.about_mastodon'
id='annual_report.shared_page.sign_up' defaultMessage='About Mastodon'
defaultMessage='Sign up' />
/> </a>
</a> </li>
)} <li>
<a href='https://joinmastodon.org/sponsors'> <a href='https://joinmastodon.org/sponsors'>
<FormattedMessage
id='annual_report.shared_page.donate'
defaultMessage='Donate'
/>
</a>
</li>
</ul>
</div>
<div className={classes.footerSection}>
<FormattedMessage
id='annual_report.shared_page.footer_server_info'
defaultMessage='{username} uses {domain}, one of many communities powered by Mastodon.'
values={{
username: <DisplayName variant='simple' account={account} />,
domain: <strong>{domain}</strong>,
}}
tagName='p'
/>
<a href='/about'>
<FormattedMessage <FormattedMessage
id='annual_report.shared_page.donate' id='footer.about_server'
defaultMessage='Donate' defaultMessage='About {domain}'
values={{ domain }}
/> />
</a> </a>
</nav> </div>
</footer> </footer>
</main> </main>
); );

View File

@@ -121,7 +121,7 @@
"annual_report.nav_item.badge": "New", "annual_report.nav_item.badge": "New",
"annual_report.shared_page.donate": "Donate", "annual_report.shared_page.donate": "Donate",
"annual_report.shared_page.footer": "Generated with {heart} by the Mastodon team", "annual_report.shared_page.footer": "Generated with {heart} by the Mastodon team",
"annual_report.shared_page.sign_up": "Sign up", "annual_report.shared_page.footer_server_info": "{username} uses {domain}, one of many communities powered by Mastodon.",
"annual_report.summary.archetype.booster.desc_public": "{name} stayed on the hunt for posts to boost, amplifying other creators with perfect aim.", "annual_report.summary.archetype.booster.desc_public": "{name} stayed on the hunt for posts to boost, amplifying other creators with perfect aim.",
"annual_report.summary.archetype.booster.desc_self": "You stayed on the hunt for posts to boost, amplifying other creators with perfect aim.", "annual_report.summary.archetype.booster.desc_self": "You stayed on the hunt for posts to boost, amplifying other creators with perfect aim.",
"annual_report.summary.archetype.booster.name": "The Archer", "annual_report.summary.archetype.booster.name": "The Archer",
@@ -441,6 +441,8 @@
"follow_suggestions.who_to_follow": "Who to follow", "follow_suggestions.who_to_follow": "Who to follow",
"followed_tags": "Followed hashtags", "followed_tags": "Followed hashtags",
"footer.about": "About", "footer.about": "About",
"footer.about_mastodon": "About Mastodon",
"footer.about_server": "About {domain}",
"footer.about_this_server": "About", "footer.about_this_server": "About",
"footer.directory": "Profiles directory", "footer.directory": "Profiles directory",
"footer.get_app": "Get the app", "footer.get_app": "Get the app",