mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-17 21:15:32 +09:00
fix(app): only animate stickers that actually have animation (#1963)
This commit is contained in:
1 parent
a3ffe963c3
commit
987768e8dc
2 files changed
+19
-2
No files matched your search
@@ -31,8 +31,8 @@ interface ChannelStickersAreaProps {
|
|||||||
|
|
||||||
export const ChannelStickersArea: React.FC<ChannelStickersAreaProps> = observer(({channelId, hasAttachments}) => {
|
export const ChannelStickersArea: React.FC<ChannelStickersAreaProps> = observer(({channelId, hasAttachments}) => {
|
||||||
const {i18n} = useLingui();
|
const {i18n} = useLingui();
|
||||||
const {shouldAnimate, interactionHandlers} = useStickerAnimation();
|
|
||||||
const sticker = ChannelSticker.getPendingSticker(channelId);
|
const sticker = ChannelSticker.getPendingSticker(channelId);
|
||||||
|
const {shouldAnimate, interactionHandlers} = useStickerAnimation({isAnimated: sticker?.animated ?? false});
|
||||||
const [previousSticker, setPreviousSticker] = useState(sticker);
|
const [previousSticker, setPreviousSticker] = useState(sticker);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (previousSticker && !sticker) {
|
if (previousSticker && !sticker) {
|
||||||
@@ -62,6 +62,7 @@ export const ChannelStickersArea: React.FC<ChannelStickersAreaProps> = observer(
|
|||||||
const stickerUrl = AvatarUtils.getStickerURL({
|
const stickerUrl = AvatarUtils.getStickerURL({
|
||||||
id: sticker.id,
|
id: sticker.id,
|
||||||
animated: shouldAnimate,
|
animated: shouldAnimate,
|
||||||
|
isAnimatable: sticker.animated,
|
||||||
size: 320,
|
size: 320,
|
||||||
});
|
});
|
||||||
return (
|
return (
|
||||||
|
|||||||
+17
-1
@@ -1,16 +1,32 @@
|
|||||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
|
||||||
import styles from '@app/features/channel/components/EmojiPicker.module.css';
|
import styles from '@app/features/channel/components/EmojiPicker.module.css';
|
||||||
|
import {useStickerAnimation} from '@app/features/emoji/hooks/useStickerAnimation';
|
||||||
import type {GuildSticker} from '@app/features/expressions/models/GuildSticker';
|
import type {GuildSticker} from '@app/features/expressions/models/GuildSticker';
|
||||||
|
import * as AvatarUtils from '@app/features/user/utils/AvatarUtils';
|
||||||
import {observer} from 'mobx-react-lite';
|
import {observer} from 'mobx-react-lite';
|
||||||
import type React from 'react';
|
import type React from 'react';
|
||||||
|
|
||||||
|
const INSPECTOR_PREVIEW_SIZE = 320;
|
||||||
|
|
||||||
interface StickerPickerInspectorProps {
|
interface StickerPickerInspectorProps {
|
||||||
hoveredSticker: GuildSticker | null;
|
hoveredSticker: GuildSticker | null;
|
||||||
style?: React.CSSProperties;
|
style?: React.CSSProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const StickerPickerInspector = observer(({hoveredSticker, style}: StickerPickerInspectorProps) => {
|
export const StickerPickerInspector = observer(({hoveredSticker, style}: StickerPickerInspectorProps) => {
|
||||||
|
const {shouldAnimate} = useStickerAnimation({
|
||||||
|
respectUserSettings: false,
|
||||||
|
isAnimated: hoveredSticker?.animated ?? false,
|
||||||
|
});
|
||||||
|
const previewUrl = hoveredSticker
|
||||||
|
? AvatarUtils.getStickerURL({
|
||||||
|
id: hoveredSticker.id,
|
||||||
|
animated: shouldAnimate,
|
||||||
|
isAnimatable: hoveredSticker.animated,
|
||||||
|
size: INSPECTOR_PREVIEW_SIZE,
|
||||||
|
})
|
||||||
|
: '';
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={styles.inspector}
|
className={styles.inspector}
|
||||||
@@ -20,7 +36,7 @@ export const StickerPickerInspector = observer(({hoveredSticker, style}: Sticker
|
|||||||
{hoveredSticker && (
|
{hoveredSticker && (
|
||||||
<>
|
<>
|
||||||
<img
|
<img
|
||||||
src={hoveredSticker.url}
|
src={previewUrl}
|
||||||
alt={hoveredSticker.name}
|
alt={hoveredSticker.name}
|
||||||
className={styles.inspectorEmoji}
|
className={styles.inspectorEmoji}
|
||||||
data-flx="channel.sticker-picker.sticker-picker-inspector.inspector-emoji"
|
data-flx="channel.sticker-picker.sticker-picker-inspector.inspector-emoji"
|
||||||
|
|||||||
Reference in new issue
Block a user