Skip to content

Commit ec8ca51

Browse files
committed
chore: misc cleanup
1 parent 1fbb552 commit ec8ca51

File tree

4 files changed

+25
-29
lines changed

4 files changed

+25
-29
lines changed

src/MainView.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
useContext,
55
useEffect,
66
} from 'react';
7-
import {StatusBar, StyleSheet, View} from 'react-native';
7+
import {StatusBar, View} from 'react-native';
88

99
import type {API, Channel, Server} from 'revolt.js';
1010

@@ -22,7 +22,7 @@ import {
2222
setUpNotifeeListener,
2323
} from '@clerotri/lib/notifications';
2424
import {storage} from '@clerotri/lib/storage';
25-
import {Theme, ThemeContext} from '@clerotri/lib/themes';
25+
import {ThemeContext} from '@clerotri/lib/themes';
2626
import {sleep} from '@clerotri/lib/utils';
2727
import {LoginViews} from '@clerotri/pages/LoginViews';
2828

@@ -99,7 +99,9 @@ function LoggedInViews({state, setChannel}: {state: any; setChannel: any}) {
9999
openChannel={() =>
100100
state.setState({
101101
notificationMessage: null,
102-
currentChannel: client.channels.get(state.state.notificationMessage.channel),
102+
currentChannel: client.channels.get(
103+
state.state.notificationMessage.channel,
104+
),
103105
})
104106
}
105107
/>

src/MessageView.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ function MessageViewErrorMessage({
128128
);
129129
}
130130

131-
export const NewMessageView = observer(
131+
const NewMessageView = observer(
132132
({
133133
channel,
134134
messages,
@@ -226,7 +226,7 @@ function handleNewMessage(
226226
setError: (error: any) => void,
227227
msg: RevoltMessage,
228228
) {
229-
console.log(`[NEWMESSAGEVIEW] Handling new message ${msg._id}`, );
229+
console.log(`[NEWMESSAGEVIEW] Handling new message ${msg._id}`);
230230

231231
if (msg.channel !== channel || handledMessages.includes(msg._id)) {
232232
return;
@@ -339,7 +339,9 @@ export const MessageView = observer(({channel}: {channel: Channel}) => {
339339

340340
function setUpListeners() {
341341
client.addListener('message', msg => onNewMessage(msg));
342-
client.addListener('message/delete', (id, msg) => onMessageDeletion(id, msg));
342+
client.addListener('message/delete', (id, msg) =>
343+
onMessageDeletion(id, msg),
344+
);
343345
}
344346

345347
function cleanupListeners() {

src/components/Notification.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {Avatar, Text, Username} from './common/atoms';
1111
import {MarkdownView} from './common/MarkdownView';
1212
import {commonValues, ThemeContext} from '@clerotri/lib/themes';
1313
import {parseRevoltNodes} from '../lib/utils';
14-
import { client } from '@clerotri/lib/client';
14+
import {client} from '@clerotri/lib/client';
1515

1616
export const Notification = observer(
1717
({
@@ -57,10 +57,7 @@ export const Notification = observer(
5757
style={{
5858
flexDirection: 'row',
5959
}}>
60-
<Username
61-
user={author}
62-
server={channel?.server}
63-
/>
60+
<Username user={author} server={channel?.server} />
6461
<Text style={{fontWeight: 'bold'}}>
6562
{' '}
6663
({channel?.name ?? channel?._id})

src/components/common/messaging/SystemMessage.tsx

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import type {Message as RevoltMessage} from 'revolt.js';
1010
import {Text, Username} from '@clerotri/components/common/atoms';
1111
import {app} from '@clerotri/Generic';
1212
import {client} from '@clerotri/lib/client';
13-
import {Theme, ThemeContext} from '@clerotri/lib/themes';
13+
import {ThemeContext} from '@clerotri/lib/themes';
1414

1515
const SYSTEM_MESSAGE_ICONS = {
1616
text: {
@@ -86,9 +86,6 @@ const SystemMessageIcon = observer(
8686

8787
export const SystemMessage = observer(
8888
({message, isReply}: {message: RevoltMessage; isReply?: boolean}) => {
89-
const {currentTheme} = useContext(ThemeContext);
90-
const localStyles = generateLocalStyles(currentTheme);
91-
9289
if (!message.system) {
9390
return <></>;
9491
}
@@ -176,17 +173,15 @@ export const SystemMessage = observer(
176173
},
177174
);
178175

179-
const generateLocalStyles = (currentTheme: Theme) => {
180-
return StyleSheet.create({
181-
containerCommon: {
182-
flex: 1,
183-
flexDirection: 'row',
184-
},
185-
containerPadding: {
186-
paddingInlineStart: 10,
187-
paddingBlockStart: app.settings.get(
188-
'ui.messaging.messageSpacing',
189-
) as number,
190-
},
191-
});
192-
};
176+
const localStyles = StyleSheet.create({
177+
containerCommon: {
178+
flex: 1,
179+
flexDirection: 'row',
180+
},
181+
containerPadding: {
182+
paddingInlineStart: 10,
183+
paddingBlockStart: app.settings.get(
184+
'ui.messaging.messageSpacing',
185+
) as number,
186+
},
187+
});

0 commit comments

Comments
 (0)