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
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

View File

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

View File

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

View File

@@ -16,22 +16,16 @@ $mobile-breakpoint: 540px;
display: flex;
flex-direction: column;
align-items: center;
gap: 0.75rem;
gap: 1.8rem;
margin-top: 2rem;
font-size: 16px;
line-height: 1.4;
text-align: center;
color: var(--color-text-secondary);
}
.logo {
width: 2rem;
opacity: 0.6;
}
.nav {
display: flex;
flex-wrap: wrap;
gap: 12px;
strong {
font-weight: 600;
}
a:any-link {
color: inherit;
@@ -43,3 +37,22 @@ $mobile-breakpoint: 540px;
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 { DisplayName } from '@/mastodon/components/display_name';
import { IconLogo } from '@/mastodon/components/logo';
import { useAppSelector } from '@/mastodon/store';
import { AnnualReport } from './index';
import { AnnualReport, accountSelector } from './index';
import classes from './shared_page.module.scss';
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 (
<main className={classes.wrapper}>
<AnnualReport />
<footer className={classes.footer}>
<IconLogo className={classes.logo} />
<FormattedMessage
id='annual_report.shared_page.footer'
defaultMessage='Generated with {heart} by the Mastodon team'
values={{ heart: '🐘' }}
/>
<nav className={classes.nav}>
<a href='https://joinmastodon.org'>
<FormattedMessage id='footer.about' defaultMessage='About' />
</a>
{!isLoggedIn && (
<a href='https://joinmastodon.org/servers'>
<FormattedMessage
id='annual_report.shared_page.sign_up'
defaultMessage='Sign up'
/>
</a>
)}
<a href='https://joinmastodon.org/sponsors'>
<div className={classes.footerSection}>
<IconLogo className={classes.logo} />
<FormattedMessage
id='annual_report.shared_page.footer'
defaultMessage='Generated with {heart} by the Mastodon team'
values={{ heart: '🐘' }}
tagName='p'
/>
<ul className={classes.linkList}>
<li>
<a href='https://joinmastodon.org'>
<FormattedMessage
id='footer.about_mastodon'
defaultMessage='About Mastodon'
/>
</a>
</li>
<li>
<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
id='annual_report.shared_page.donate'
defaultMessage='Donate'
id='footer.about_server'
defaultMessage='About {domain}'
values={{ domain }}
/>
</a>
</nav>
</div>
</footer>
</main>
);

View File

@@ -121,7 +121,7 @@
"annual_report.nav_item.badge": "New",
"annual_report.shared_page.donate": "Donate",
"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_self": "You stayed on the hunt for posts to boost, amplifying other creators with perfect aim.",
"annual_report.summary.archetype.booster.name": "The Archer",
@@ -441,6 +441,8 @@
"follow_suggestions.who_to_follow": "Who to follow",
"followed_tags": "Followed hashtags",
"footer.about": "About",
"footer.about_mastodon": "About Mastodon",
"footer.about_server": "About {domain}",
"footer.about_this_server": "About",
"footer.directory": "Profiles directory",
"footer.get_app": "Get the app",