Skip to content

Commit

Permalink
chore: run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
Rexogamer committed Jan 19, 2025
1 parent 78f5c47 commit e67c98a
Show file tree
Hide file tree
Showing 21 changed files with 88 additions and 56 deletions.
4 changes: 2 additions & 2 deletions src/LegacyMessageView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,8 @@ export class Messages extends ReactComponent {
input.type === 'before'
? messages.concat(oldMessages)
: input.type === 'after'
? oldMessages.concat(messages)
: messages;
? oldMessages.concat(messages)
: messages;
// const lastResultID = result[result.length - 1]._id;
// console.log(`result last message id: ${lastResultID}`);
this.setState({
Expand Down
4 changes: 2 additions & 2 deletions src/components/MessageBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@ export const MessageBox = observer((props: MessageBoxProps) => {
props.channel.channel_type === 'Group'
? props.channel.name
: props.channel.channel_type === 'DirectMessage'
? props.channel.recipient?.username ?? 'User'
: '',
? (props.channel.recipient?.username ?? 'User')
: '',
})}
onChangeText={text => {
setCurrentText(text);
Expand Down
8 changes: 4 additions & 4 deletions src/components/common/atoms/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ export const Avatar = observer(
(masquerade
? masquerade
: server &&
memberObject?.generateAvatarURL &&
memberObject?.generateAvatarURL()
? memberObject?.generateAvatarURL()
: user?.generateAvatarURL()) +
memberObject?.generateAvatarURL &&
memberObject?.generateAvatarURL()
? memberObject?.generateAvatarURL()
: user?.generateAvatarURL()) +
'?max_side=' +
DEFAULT_MAX_SIDE,
}}
Expand Down
4 changes: 3 additions & 1 deletion src/components/common/atoms/BackButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ export function BackButton({
marginLeft: 5,
}}>
{t(
label ?? type === 'close' ? 'app.actions.close' : 'app.actions.back',
(label ?? type === 'close')
? 'app.actions.close'
: 'app.actions.back',
)}
</Text>
</Pressable>
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/atoms/ChannelButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export const ChannelButton = observer(
</View>
<Text style={{flex: 1, fontWeight: 'bold', color, fontSize: 15}}>
{typeof channel !== 'string'
? channel.name ?? `${channel}`
? (channel.name ?? `${channel}`)
: channel}
</Text>
{showUnread && typeof channel !== 'string' && pings > 0 ? (
Expand Down
4 changes: 2 additions & 2 deletions src/components/common/atoms/Username.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ export const Username = observer(
server && memberObject?.nickname
? memberObject?.nickname
: !skipDisplayName
? user.display_name ?? user.username
: user.username;
? (user.display_name ?? user.username)
: user.username;

if (server && memberObject?.roles && memberObject?.roles?.length > 0) {
let srv = client.servers.get(memberObject._id.server);
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/messaging/Emoji.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export function renderEmoji(content: string) {
});
} else {
renderedSubparts = subparts.map((id, i) =>
i % 2 === 1 ? RevoltEmojiDictionary[id] ?? `:${id}:` : id,
i % 2 === 1 ? (RevoltEmojiDictionary[id] ?? `:${id}:`) : id,
);
}
return renderedSubparts;
Expand Down
12 changes: 6 additions & 6 deletions src/components/common/messaging/InviteEmbed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ export const InviteEmbed = observer(
const errorType = stringE.match('404')
? 'notFound'
: stringE.match('429')
? 'rateLimited'
: 'otherError';
? 'rateLimited'
: 'otherError';
if (errorType === 'otherError') {
console.warn(
`[INVITEEMBED] Unrecognised error fetching invite: ${e}`,
Expand Down Expand Up @@ -75,15 +75,15 @@ export const InviteEmbed = observer(
{error === 'notFound'
? "This invite doesn't exist"
: error === 'rateLimited'
? 'Too many requests'
: 'An error occurred'}
? 'Too many requests'
: 'An error occurred'}
</Text>
<Text>
{error === 'notFound'
? `The invite may have expired or been deleted. Ask ${message.author?.username} for a new one.`
: error === 'rateLimited'
? "You've fetched too many invites in a short period of time. Wait a few minutes and try again."
: 'Something went wrong. Please try again later.'}
? "You've fetched too many invites in a short period of time. Wait a few minutes and try again."
: 'Something went wrong. Please try again later.'}
</Text>
</InviteBackground>
) : invObject.type === 'Server' ? (
Expand Down
6 changes: 5 additions & 1 deletion src/components/common/messaging/Message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ import {SystemMessage} from '@clerotri/components/common/messaging/SystemMessage
import {Image} from '@clerotri/crossplat/Image';
import {RE_INVITE, USER_IDS} from '@clerotri/lib/consts';
import {commonValues, Theme, ThemeContext} from '@clerotri/lib/themes';
import {getReadableFileSize, openUrl, parseRevoltNodes} from '@clerotri/lib/utils';
import {
getReadableFileSize,
openUrl,
parseRevoltNodes,
} from '@clerotri/lib/utils';

type MessageProps = {
message: RevoltMessage;
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/messaging/MessageEmbed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export const MessageEmbed = observer((eRaw: API.Embed) => {
console.log(`[MESSAGEEMBED] Unknown embed type: ${JSON.stringify(e)}`);
return (app.settings.get('ui.showDeveloperFeatures') as boolean) ? (
<Text>
embed - type: {e.type === 'None' ? 'none' : e.type ?? 'how'}, other
embed - type: {e.type === 'None' ? 'none' : (e.type ?? 'how')}, other
info:
{JSON.stringify(e)}
</Text>
Expand Down
18 changes: 9 additions & 9 deletions src/components/common/messaging/PlatformModerationMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export const PlatformModerationMessage = observer(

try {
reportReason = rawReportReason
? rawReportReason[0] ?? 'UNKNOWN'
? (rawReportReason[0] ?? 'UNKNOWN')
: 'UNKNOWN';
} catch (error) {
console.log(
Expand Down Expand Up @@ -205,19 +205,19 @@ export const PlatformModerationMessage = observer(
responseType === 'POSITIVE'
? currentTheme.statusOnline
: responseType === 'MIXED'
? currentTheme.statusIdle
: responseType === 'NEGATIVE'
? currentTheme.statusBusy
: currentTheme.statusInvisible
? currentTheme.statusIdle
: responseType === 'NEGATIVE'
? currentTheme.statusBusy
: currentTheme.statusInvisible
}
name={
responseType === 'POSITIVE'
? 'check'
: responseType === 'MIXED'
? 'warning'
: responseType === 'NEGATIVE'
? 'not-interested'
: 'question-mark'
? 'warning'
: responseType === 'NEGATIVE'
? 'not-interested'
: 'question-mark'
}
size={16}
/>
Expand Down
11 changes: 9 additions & 2 deletions src/components/common/settings/sections/app/AppInfoSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import MaterialCommunityIcon from 'react-native-vector-icons/MaterialCommunityIc

import {dependencies} from '../../../../../../package.json';
import {app} from '@clerotri/Generic';
import {CONTRIBUTORS_LIST, FEDI_PROFILE, GITHUB_REPO} from '@clerotri/lib/consts';
import {
CONTRIBUTORS_LIST,
FEDI_PROFILE,
GITHUB_REPO,
} from '@clerotri/lib/consts';
import {ThemeContext} from '@clerotri/lib/themes';
import {openUrl} from '@clerotri/lib/utils';
import {ContextButton, Link, Text} from '@clerotri/components/common/atoms';
Expand Down Expand Up @@ -43,7 +47,10 @@ export const AppInfoSection = () => {
<AppIcon height={250} width={250} />
</View>
<View style={{alignItems: 'center', marginVertical: 16}}>
<Text type={'h1'}>Clerotri <Text colour={currentTheme.foregroundSecondary}>v{app.version}</Text></Text>
<Text type={'h1'}>
Clerotri{' '}
<Text colour={currentTheme.foregroundSecondary}>v{app.version}</Text>
</Text>
<Text>
Powered by{' '}
<Link link={'https://reactnative.dev'} label={'React Native'} /> v
Expand Down
7 changes: 6 additions & 1 deletion src/components/pages/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ import {
} from '@clerotri/lib/consts';
import {openUrl} from '@clerotri/lib/utils';
import {styles} from '@clerotri/Theme';
import {Avatar, Button, Text, Username} from '@clerotri/components/common/atoms';
import {
Avatar,
Button,
Text,
Username,
} from '@clerotri/components/common/atoms';
import {ChannelHeader} from '@clerotri/components/navigation/ChannelHeader';
import {SpecialChannelIcon} from '@clerotri/components/navigation/SpecialChannelIcon';

Expand Down
7 changes: 6 additions & 1 deletion src/components/sheets/ReportSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ import type {Message} from 'revolt.js';

import {app, setFunction} from '@clerotri/Generic';
import {client} from '@clerotri/lib/client';
import {Avatar, Button, Text, Username} from '@clerotri/components/common/atoms';
import {
Avatar,
Button,
Text,
Username,
} from '@clerotri/components/common/atoms';
import {BottomSheet} from '@clerotri/components/common/BottomSheet';
import {MarkdownView} from '@clerotri/components/common/MarkdownView';
import {USER_IDS} from '@clerotri/lib/consts';
Expand Down
8 changes: 4 additions & 4 deletions src/components/sheets/ServerInfoSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,10 @@ export const ServerInfoSheet = observer(() => {
{server._id === SPECIAL_SERVERS.lounge.id
? 'Member count disabled for this server'
: members
? `${members.length} ${
members.length === 1 ? 'member' : 'members'
}`
: 'Fetching member count...'}
? `${members.length} ${
members.length === 1 ? 'member' : 'members'
}`
: 'Fetching member count...'}
</Text>
{server.description ? (
<View
Expand Down
6 changes: 5 additions & 1 deletion src/components/sheets/SettingsSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ import {ThemeContext} from '@clerotri/lib/themes';
import {SettingsSection} from '@clerotri/lib/types';
import {openUrl} from '@clerotri/lib/utils';
import {styles} from '@clerotri/Theme';
import {BackButton, ContextButton, Text} from '@clerotri/components/common/atoms';
import {
BackButton,
ContextButton,
Text,
} from '@clerotri/components/common/atoms';
import {SettingsCategory} from '@clerotri/components/common/settings';
import {
AppInfoSection,
Expand Down
4 changes: 2 additions & 2 deletions src/components/views/ChannelView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ export const ChannelView = observer(({channel}: {channel: CVChannel}) => {
channel.channel_type === 'DirectMessage'
? channel.recipient?.username
: channel.channel_type === 'SavedMessages'
? 'Saved Notes'
: channel.name ?? ''
? 'Saved Notes'
: (channel.name ?? '')
}>
{channel.channel_type !== 'VoiceChannel' ? (
<View style={{marginEnd: 16}}>
Expand Down
4 changes: 2 additions & 2 deletions src/lib/auth/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ export async function loginWithSavedToken(status: any) {
client.user
? app.setLoggedOutScreen('loginPage')
: status === 'loggedIn'
? null
: app.setLoggedOutScreen('loginPage');
? null
: app.setLoggedOutScreen('loginPage');
}
} catch (err) {
console.log(err);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/notifications/notifee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ export async function sendNotifeeNotification(
msg.channel?.server?.name
? `#${msg.channel.name} (${msg.channel.server.name})`
: msg.channel?.channel_type === 'Group'
? `${msg.channel.name}`
: `@${msg.channel?.recipient?.username}`
? `${msg.channel.name}`
: `@${msg.channel?.recipient?.username}`
}`;

try {
Expand Down
8 changes: 4 additions & 4 deletions src/lib/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ export function getReadableFileSize(size: number | null) {
? size / 1000000 >= 0.01
? `${(size / 1000000).toFixed(2)} MB`
: size / 10000 >= 0.01
? `${(size / 1000).toFixed(2)} KB`
: `${size} bytes`
? `${(size / 1000).toFixed(2)} KB`
: `${size} bytes`
: 'Unknown';
}

Expand Down Expand Up @@ -129,8 +129,8 @@ export async function fetchMessages(
input.type === 'before'
? messages.concat(oldMessages)
: input.type === 'after'
? oldMessages.concat(messages)
: messages;
? oldMessages.concat(messages)
: messages;
console.log(
`[FETCHEDMESSAGES] Finished preparing fetched messages for ${channel._id}`,
);
Expand Down
19 changes: 12 additions & 7 deletions src/pages/auth/LoginSettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ import {View} from 'react-native';
import {useBackHandler} from '@react-native-community/hooks/lib/useBackHandler';

import {app} from '@clerotri/Generic';
import {BackButton, Button, Input, Text} from '@clerotri/components/common/atoms';
import {
BackButton,
Button,
Input,
Text,
} from '@clerotri/components/common/atoms';
import {LoadingScreen} from '@clerotri/components/views/LoadingScreen';
import {commonValues, ThemeContext} from '@clerotri/lib/themes';

Expand Down Expand Up @@ -89,12 +94,12 @@ export const LoginSettingsPage = ({callback}: {callback: () => void}) => {
{testResponse === 'valid'
? 'This looks like a Revolt instance!'
: testResponse === 'invalid'
? "This doesn't look like a Revolt instance..."
: testResponse === 'notJSON'
? "Could not parse response. Make sure you're linking to the API URL!"
: testResponse === 'requestFailed'
? 'Could not fetch that URL.'
: 'Something went wrong!'}
? "This doesn't look like a Revolt instance..."
: testResponse === 'notJSON'
? "Could not parse response. Make sure you're linking to the API URL!"
: testResponse === 'requestFailed'
? 'Could not fetch that URL.'
: 'Something went wrong!'}
</Text>
) : null}
<Button
Expand Down

0 comments on commit e67c98a

Please sign in to comment.