pl-fe: code style

Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
nicole mikołajczyk
2025-10-14 06:00:07 +02:00
parent c2a3221667
commit a87b7bafd2
3 changed files with 87 additions and 93 deletions

View File

@ -1,16 +1,14 @@
import React from 'react';
/** Fullscreen loading indicator. */
const LoadingScreen: React.FC = () => {
return (
<div className='loading-indicator-wrapper'>
<div className='loading-indicator'>
<div className='loading-indicator__container'>
<div className='loading-indicator__figure' />
</div>
const LoadingScreen: React.FC = () => (
<div className='loading-indicator-wrapper'>
<div className='loading-indicator'>
<div className='loading-indicator__container'>
<div className='loading-indicator__figure' />
</div>
</div>
);
};
</div>
);
export { LoadingScreen as default };

View File

@ -12,51 +12,49 @@ import sourceCode from 'pl-fe/utils/code';
import { LogoText } from '../timelines/landing-timeline';
const LandingPage = () => {
return (
<>
<Column withHeader={false}>
<Stack space={4}>
<LogoText>
pl-fe
</LogoText>
<Text><FormattedMessage id='landing.description' defaultMessage='pl-fe is a feature-rich Fediverse web client.' /></Text>
<HStack justifyContent='end' space={4}>
<Button href={sourceCode.url}><FormattedMessage id='landing.source_code' defaultMessage='Source code' /></Button>
<Button to='/login/external' theme='primary'><FormattedMessage id='landing.sign_in' defaultMessage='Sign in' /></Button>
</HStack>
<Card variant='rounded'>
<CardTitle title={<FormattedMessage id='landing.use_with_platform.title' defaultMessage='Use with your favorite Fediverse platform.' />} truncate={false} />
<Text><FormattedMessage id='landing.use_with_platform.description' defaultMessage='pl-fe works with any backend implementing Mastodon API.' /></Text>
</Card>
<Card variant='rounded'>
<CardTitle title={<FormattedMessage id='landing.feature_rich.title' defaultMessage='Feature-rich.' />} truncate={false} />
<Text><FormattedMessage id='landing.feature_rich.description' defaultMessage='pl-fe includes a lot features to improve your experience, like WYSIWYG text editor, draft posts and language detection.' /></Text>
</Card>
<Card variant='rounded'>
<CardTitle title={<FormattedMessage id='landing.pl_api.title' defaultMessage='Get the most out of your Fediverse instance.' />} truncate={false} />
<Text><FormattedMessage id='landing.pl_api.description' defaultMessage='pl-fe implements features not present in standard Mastodon API, like emoji reactions, chats or interaction policies.' /></Text>
</Card>
<Card variant='rounded'>
<CardTitle title={<FormattedMessage id='landing.customizable.title' defaultMessage='Customizable.' />} truncate={false} />
<Text><FormattedMessage id='landing.customizable.description' defaultMessage='pl-fe lets you choose between three themes and adjust accent color to your liking.' /></Text>
</Card>
<Card variant='rounded'>
<CardTitle title={<FormattedMessage id='landing.private.title' defaultMessage='Stay private.' />} truncate={false} />
<Text><FormattedMessage id='landing.private.description' defaultMessage='pl-fe includes features which help you maintain online privacy. This includes URL cleaning, which helps you remove unwanted parts of URLs used to mark your online activity.' /></Text>
</Card>
<Card variant='rounded'>
<CardTitle title={<FormattedMessage id='landing.open_source.title' defaultMessage='Open source.' />} truncate={false} />
<Text><FormattedMessage id='landing.open_source.description' defaultMessage='pl-fe is free and open source software. You can participate in development, contribute to the project or report bugs.' /></Text>
</Card>
</Stack>
</Column>
<Stack space={4} className='mt-4 px-4 xl:hidden'>
<LinkFooter />
const LandingPage = () => (
<>
<Column withHeader={false}>
<Stack space={4}>
<LogoText>
pl-fe
</LogoText>
<Text><FormattedMessage id='landing.description' defaultMessage='pl-fe is a feature-rich Fediverse web client.' /></Text>
<HStack justifyContent='end' space={4}>
<Button href={sourceCode.url}><FormattedMessage id='landing.source_code' defaultMessage='Source code' /></Button>
<Button to='/login/external' theme='primary'><FormattedMessage id='landing.sign_in' defaultMessage='Sign in' /></Button>
</HStack>
<Card variant='rounded'>
<CardTitle title={<FormattedMessage id='landing.use_with_platform.title' defaultMessage='Use with your favorite Fediverse platform.' />} truncate={false} />
<Text><FormattedMessage id='landing.use_with_platform.description' defaultMessage='pl-fe works with any backend implementing Mastodon API.' /></Text>
</Card>
<Card variant='rounded'>
<CardTitle title={<FormattedMessage id='landing.feature_rich.title' defaultMessage='Feature-rich.' />} truncate={false} />
<Text><FormattedMessage id='landing.feature_rich.description' defaultMessage='pl-fe includes a lot features to improve your experience, like WYSIWYG text editor, draft posts and language detection.' /></Text>
</Card>
<Card variant='rounded'>
<CardTitle title={<FormattedMessage id='landing.pl_api.title' defaultMessage='Get the most out of your Fediverse instance.' />} truncate={false} />
<Text><FormattedMessage id='landing.pl_api.description' defaultMessage='pl-fe implements features not present in standard Mastodon API, like emoji reactions, chats or interaction policies.' /></Text>
</Card>
<Card variant='rounded'>
<CardTitle title={<FormattedMessage id='landing.customizable.title' defaultMessage='Customizable.' />} truncate={false} />
<Text><FormattedMessage id='landing.customizable.description' defaultMessage='pl-fe lets you choose between three themes and adjust accent color to your liking.' /></Text>
</Card>
<Card variant='rounded'>
<CardTitle title={<FormattedMessage id='landing.private.title' defaultMessage='Stay private.' />} truncate={false} />
<Text><FormattedMessage id='landing.private.description' defaultMessage='pl-fe includes features which help you maintain online privacy. This includes URL cleaning, which helps you remove unwanted parts of URLs used to mark your online activity.' /></Text>
</Card>
<Card variant='rounded'>
<CardTitle title={<FormattedMessage id='landing.open_source.title' defaultMessage='Open source.' />} truncate={false} />
<Text><FormattedMessage id='landing.open_source.description' defaultMessage='pl-fe is free and open source software. You can participate in development, contribute to the project or report bugs.' /></Text>
</Card>
</Stack>
</>
);
};
</Column>
<Stack space={4} className='mt-4 px-4 xl:hidden'>
<LinkFooter />
</Stack>
</>
);
export { LandingPage as default };

View File

@ -122,51 +122,49 @@ const checkFiltered = (index: string, filters: Array<Filter>) =>
type APIStatus = { id: string; username?: string };
const makeGetStatus = () => {
return createSelector(
[
(state: RootState, { id }: APIStatus) => state.statuses[id],
(state: RootState, { id }: APIStatus) => state.statuses[state.statuses[id]?.reblog_id || ''] || null,
(state: RootState, { id }: APIStatus) => state.statuses[state.statuses[id]?.quote_id || ''] || null,
(state: RootState, { id }: APIStatus) => {
const group = state.statuses[id]?.group_id;
if (group) return state.entities[Entities.GROUPS]?.store[group] as Group;
return undefined;
},
(state: RootState, { id }: APIStatus) => state.polls[id] || null,
(_state: RootState, { username }: APIStatus) => username,
getFilters,
(state: RootState) => state.me,
(state: RootState) => state.auth.client.features,
],
const makeGetStatus = () => createSelector(
[
(state: RootState, { id }: APIStatus) => state.statuses[id],
(state: RootState, { id }: APIStatus) => state.statuses[state.statuses[id]?.reblog_id || ''] || null,
(state: RootState, { id }: APIStatus) => state.statuses[state.statuses[id]?.quote_id || ''] || null,
(state: RootState, { id }: APIStatus) => {
const group = state.statuses[id]?.group_id;
if (group) return state.entities[Entities.GROUPS]?.store[group] as Group;
return undefined;
},
(state: RootState, { id }: APIStatus) => state.polls[id] || null,
(_state: RootState, { username }: APIStatus) => username,
getFilters,
(state: RootState) => state.me,
(state: RootState) => state.auth.client.features,
],
(statusBase, statusReblog, statusQuote, statusGroup, poll, username, filters, me, features) => {
(statusBase, statusReblog, statusQuote, statusGroup, poll, username, filters, me, features) => {
// const locale = getLocale('en');
if (!statusBase) return null;
const { account } = statusBase;
const accountUsername = account.acct;
if (!statusBase) return null;
const { account } = statusBase;
const accountUsername = account.acct;
// Must be owner of status if username exists.
if (accountUsername !== username && username !== undefined) {
return null;
}
// Must be owner of status if username exists.
if (accountUsername !== username && username !== undefined) {
return null;
}
const filtered = features.filtersV2
? statusBase.filtered
: features.filters && account.id !== me && checkFiltered(statusReblog?.search_index || statusBase.search_index || '', filters) || [];
const filtered = features.filtersV2
? statusBase.filtered
: features.filters && account.id !== me && checkFiltered(statusReblog?.search_index || statusBase.search_index || '', filters) || [];
return {
...statusBase,
reblog: statusReblog || null,
quote: statusQuote || null,
group: statusGroup || null,
poll,
filtered,
};
},
);
};
return {
...statusBase,
reblog: statusReblog || null,
quote: statusQuote || null,
group: statusGroup || null,
poll,
filtered,
};
},
);
type SelectedStatus = Exclude<ReturnType<ReturnType<typeof makeGetStatus>>, null>;