-
-
Notifications
You must be signed in to change notification settings - Fork 277
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix type * fix missing member from reaction * stop context menu event propagation in msg modal * prevent encode blur hash from freezing app * replace roboto font with inter and fix weight * add recent emoji when selecting emoji * fix room latest evt hook * add option to drop typing status
- Loading branch information
Showing
18 changed files
with
138 additions
and
64 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* eslint-disable no-continue */ | ||
import { MatrixEvent, Room, RoomEvent, RoomEventHandlerMap } from 'matrix-js-sdk'; | ||
import { useEffect, useState } from 'react'; | ||
import { settingsAtom } from '../state/settings'; | ||
import { useSetting } from '../state/hooks/settings'; | ||
import { MessageEvent, StateEvent } from '../../types/matrix/room'; | ||
|
||
export const useRoomLatestRenderedEvent = (room: Room) => { | ||
const [hideMembershipEvents] = useSetting(settingsAtom, 'hideMembershipEvents'); | ||
const [hideNickAvatarEvents] = useSetting(settingsAtom, 'hideNickAvatarEvents'); | ||
const [showHiddenEvents] = useSetting(settingsAtom, 'showHiddenEvents'); | ||
const [latestEvent, setLatestEvent] = useState<MatrixEvent>(); | ||
|
||
useEffect(() => { | ||
const getLatestEvent = (): MatrixEvent | undefined => { | ||
const liveEvents = room.getLiveTimeline().getEvents(); | ||
for (let i = liveEvents.length - 1; i >= 0; i -= 1) { | ||
const evt = liveEvents[i]; | ||
|
||
if (!evt) continue; | ||
if (evt.isRelation()) continue; | ||
if (evt.getType() === StateEvent.RoomMember) { | ||
const membershipChanged = evt.getContent().membership !== evt.getPrevContent().membership; | ||
if (membershipChanged && hideMembershipEvents) continue; | ||
if (!membershipChanged && hideNickAvatarEvents) continue; | ||
return evt; | ||
} | ||
|
||
if ( | ||
evt.getType() === MessageEvent.RoomMessage || | ||
evt.getType() === MessageEvent.RoomMessageEncrypted || | ||
evt.getType() === MessageEvent.Sticker || | ||
evt.getType() === StateEvent.RoomName || | ||
evt.getType() === StateEvent.RoomTopic || | ||
evt.getType() === StateEvent.RoomAvatar | ||
) { | ||
return evt; | ||
} | ||
|
||
if (showHiddenEvents) return evt; | ||
} | ||
return undefined; | ||
}; | ||
|
||
const handleTimelineEvent: RoomEventHandlerMap[RoomEvent.Timeline] = () => { | ||
setLatestEvent(getLatestEvent()); | ||
}; | ||
setLatestEvent(getLatestEvent()); | ||
|
||
room.on(RoomEvent.Timeline, handleTimelineEvent); | ||
return () => { | ||
room.removeListener(RoomEvent.Timeline, handleTimelineEvent); | ||
}; | ||
}, [room, hideMembershipEvents, hideNickAvatarEvents, showHiddenEvents]); | ||
|
||
return latestEvent; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { createTheme } from '@vanilla-extract/css'; | ||
import { config } from 'folds'; | ||
|
||
export const onLightFontWeight = createTheme(config.fontWeight, { | ||
W100: '100', | ||
W200: '200', | ||
W300: '300', | ||
W400: '420', | ||
W500: '500', | ||
W600: '600', | ||
W700: '700', | ||
W800: '800', | ||
W900: '900', | ||
}); | ||
|
||
export const onDarkFontWeight = createTheme(config.fontWeight, { | ||
W100: '100', | ||
W200: '200', | ||
W300: '300', | ||
W400: '350', | ||
W500: '450', | ||
W600: '550', | ||
W700: '650', | ||
W800: '750', | ||
W900: '850', | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.