Skip to content

Commit

Permalink
remove animations
Browse files Browse the repository at this point in the history
  • Loading branch information
mat-sz committed Oct 25, 2023
1 parent c5ff381 commit 98a40f9
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 85 deletions.
1 change: 0 additions & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"matcrypt": "^1.3.0",
"mobx": "^6.10.2",
"mobx-react-lite": "^4.0.5",
"nanoanim": "^0.1.0",
"preact": "^10.18.1",
"preact-compat": "^3.19.0",
"pwanow": "^0.0.1",
Expand Down
19 changes: 8 additions & 11 deletions web/src/components/Network.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import { observer } from 'mobx-react-lite';
import { AnimatePresence } from 'nanoanim';

import styles from './Network.module.scss';
import { NetworkTile } from './NetworkTile.js';
Expand All @@ -21,16 +20,14 @@ export const Network: React.FC<NetworkProps> = observer(

return (
<div className={styles.network}>
<AnimatePresence>
{clients.map(client => (
<NetworkTile
key={client.clientId}
client={client}
onSelect={onSelect}
icon={icon}
/>
))}
</AnimatePresence>
{clients.map(client => (
<NetworkTile
key={client.clientId}
client={client}
onSelect={onSelect}
icon={icon}
/>
))}
</div>
);
}
Expand Down
21 changes: 8 additions & 13 deletions web/src/components/Status.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import { useTranslation } from 'react-i18not';
import { AnimatePresence, motion } from 'nanoanim';
import { observer } from 'mobx-react-lite';
import clsx from 'clsx';

Expand All @@ -11,16 +10,12 @@ import { connection } from '../stores/index.js';
export const Status: React.FC = observer(() => {
const { t } = useTranslation();

return (
<AnimatePresence>
{!connection.connected && !connection.disconnectReason ? (
<motion.div
{...animationPropsOpacity}
className={clsx(styles.status, styles.error)}
>
<div>{t('state.connecting')}</div>
</motion.div>
) : null}
</AnimatePresence>
);
return !connection.connected && !connection.disconnectReason ? (
<div
{...animationPropsOpacity}
className={clsx(styles.status, styles.error)}
>
<div>{t('state.connecting')}</div>
</div>
) : null;
});
89 changes: 40 additions & 49 deletions web/src/sections/Chat/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18not';
import { AnimatePresence, motion } from 'nanoanim';
import Textarea from 'react-expanding-textarea';
import { observer } from 'mobx-react-lite';
import { IoSend, IoChatbox, IoGlobe, IoClipboard } from 'react-icons/io5';
Expand Down Expand Up @@ -58,62 +57,54 @@ export const ChatSection: React.FC = observer(() => {
<div className={clsx('subsection', 'mobileFlex', styles.chat)}>
<div className={styles.channels}>
<div className={styles.list}>
<AnimatePresence>
{channels.map(channel =>
channel.client ? (
<TargetTile
className={clsx(styles.channel, {
[styles.active]:
chatStore.currentChannel === channel.channel,
})}
variant="small"
key={channel.channel}
client={channel.client}
onClick={() => chatStore.selectChannel(channel.channel)}
>
<NotificationCount count={channel.unread} />
</TargetTile>
) : (
<div
key={channel.channel}
className={clsx(styles.channel, styles.global, {
[styles.active]:
chatStore.currentChannel === channel.channel,
})}
onClick={() => chatStore.selectChannel(channel.channel)}
>
<NotificationCount count={channel.unread} />
<IoGlobe />
</div>
)
)}
</AnimatePresence>
{channels.map(channel =>
channel.client ? (
<TargetTile
className={clsx(styles.channel, {
[styles.active]: chatStore.currentChannel === channel.channel,
})}
variant="small"
key={channel.channel}
client={channel.client}
onClick={() => chatStore.selectChannel(channel.channel)}
>
<NotificationCount count={channel.unread} />
</TargetTile>
) : (
<div
key={channel.channel}
className={clsx(styles.channel, styles.global, {
[styles.active]: chatStore.currentChannel === channel.channel,
})}
onClick={() => chatStore.selectChannel(channel.channel)}
>
<NotificationCount count={channel.unread} />
<IoGlobe />
</div>
)
)}
</div>
</div>
<React.Fragment key={chatStore.currentChannel}>
{chat.length === 0 ? (
<AnimatePresence>
<motion.div className={styles.empty} {...animationPropsOpacity}>
<IoChatbox />
<div className={styles.title}>{t('emptyChat.title')}</div>
<div>
{chatStore.currentChannel === 'global'
? t('emptyChat.body')
: t('emptyChat.bodyTarget', {
target: chatStore.currentChannelName,
})}
</div>
</motion.div>
</AnimatePresence>
<div className={styles.empty} {...animationPropsOpacity}>
<IoChatbox />
<div className={styles.title}>{t('emptyChat.title')}</div>
<div>
{chatStore.currentChannel === 'global'
? t('emptyChat.body')
: t('emptyChat.bodyTarget', {
target: chatStore.currentChannelName,
})}
</div>
</div>
) : (
<div className={styles.items}>
<div className={styles.placeholder} />
<ul ref={containerRef}>
<AnimatePresence>
{chat.map(item => (
<ChatItem key={item.id} item={item} />
))}
</AnimatePresence>
{chat.map(item => (
<ChatItem key={item.id} item={item} />
))}
</ul>
</div>
)}
Expand Down
9 changes: 3 additions & 6 deletions web/src/sections/Transfers/Queue.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
import { AnimatePresence } from 'nanoanim';
import { observer } from 'mobx-react-lite';

import styles from './Queue.module.scss';
Expand All @@ -26,11 +25,9 @@ export const Queue: React.FC<Props> = observer(
</div>
<ul className={styles.queue}>
{showTotal && <Total transfers={transfers} />}
<AnimatePresence>
{transfers.map(transfer => (
<TransferInfo key={transfer.transferId} transfer={transfer} />
))}
</AnimatePresence>
{transfers.map(transfer => (
<TransferInfo key={transfer.transferId} transfer={transfer} />
))}
</ul>
</div>
)}
Expand Down
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4493,11 +4493,6 @@ ms@^2.1.1:
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2"
integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==

nanoanim@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/nanoanim/-/nanoanim-0.1.0.tgz#fe78f9fca42be740931ee621a28b41a2e9f7a757"
integrity sha512-iLLE8WPqnPMRuGV3IWGEkd5VJ+qXoEw54B92affKrHk8qnekFDwcyp3t9ZBVKO/vGZpUqSXoswnvQPEs8sAXjA==

nanoid@^3.3.6:
version "3.3.6"
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.6.tgz#443380c856d6e9f9824267d960b4236ad583ea4c"
Expand Down

0 comments on commit 98a40f9

Please sign in to comment.