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 25, 2025
1 parent 66204f7 commit fba425f
Show file tree
Hide file tree
Showing 18 changed files with 71 additions and 74 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
26 changes: 13 additions & 13 deletions src/MainView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,19 +145,19 @@ function AppViews({state}: {state: any}) {
}
barStyle={`${currentTheme.contentType}-content`}
/>
{state.state.status === 'loggedIn' ? (
<LoggedInViews state={state} setChannel={setChannel} />
) : state.state.status === 'loggedOut' ? (
<LoginViews
markAsLoggedIn={() => state.setState({status: 'loggedIn'})}
/>
) : (
<LoadingScreen
header={'app.loading.unknown_state'}
body={'app.loading.unknown_state_body'}
bodyParams={{state: state.state.status}}
/>
)}
{state.state.status === 'loggedIn' ? (
<LoggedInViews state={state} setChannel={setChannel} />
) : state.state.status === 'loggedOut' ? (
<LoginViews
markAsLoggedIn={() => state.setState({status: 'loggedIn'})}
/>
) : (
<LoadingScreen
header={'app.loading.unknown_state'}
body={'app.loading.unknown_state_body'}
bodyParams={{state: state.state.status}}
/>
)}
</>
);
}
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: 1 addition & 3 deletions src/components/common/atoms/BackButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ 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
19 changes: 9 additions & 10 deletions src/components/common/messaging/Message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -392,16 +392,15 @@ export const Message = observer((props: MessageProps) => {
/>
);
})}
{props.message.embeds && props.message.embeds.map((e, i) => {
return (
<MessageEmbed
key={`message-${
props.message._id
}-embed-${i}`}
embed={e}
/>
);
})}
{props.message.embeds &&
props.message.embeds.map((e, i) => {
return (
<MessageEmbed
key={`message-${props.message._id}-embed-${i}`}
embed={e}
/>
);
})}
{app.settings.get('ui.messaging.showReactions') ? (
<MessageReactions msg={props.message} reactions={reactions} />
) : null}
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
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
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
12 changes: 6 additions & 6 deletions src/pages/auth/LoginSettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,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 fba425f

Please sign in to comment.