Skip to content

Commit d5ced10

Browse files
authored
Merge pull request #308 from SableClient/feat/large-room-call-button
add toggle to show call button for large rooms
2 parents 4badb37 + 2e94050 commit d5ced10

4 files changed

Lines changed: 36 additions & 1 deletion

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
default: minor
3+
---
4+
5+
Added a toggle to enable/disable showing the call button for large (> 10 member) rooms.

src/app/features/room/RoomViewHeader.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,8 @@ export function RoomViewHeader({ callView }: { callView?: boolean }) {
361361
.getLiveTimeline()
362362
.getState(EventTimeline.FORWARDS)
363363
?.maySendStateEvent('org.matrix.msc3401.call.member', mx.getUserId()!);
364+
const [alwaysShowCallButton] = useSetting(settingsAtom, 'alwaysShowCallButton');
365+
const shouldShowCallButton = alwaysShowCallButton || room.getJoinedMemberCount() <= 10;
364366

365367
const encryptionEvent = useStateEvent(room, StateEvent.RoomEncryption);
366368
const encryptedRoom = !!encryptionEvent;
@@ -708,7 +710,7 @@ export function RoomViewHeader({ callView }: { callView?: boolean }) {
708710
</IconButton>
709711
)}
710712
</TooltipProvider>
711-
{canUseCalls && <RoomCallButton room={room} />}
713+
{canUseCalls && shouldShowCallButton && <RoomCallButton room={room} />}
712714
<PopOut
713715
anchor={pinMenuAnchor}
714716
position="Bottom"

src/app/features/settings/general/General.tsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,31 @@ function EmojiSelectorThresholdInput() {
823823
);
824824
}
825825

826+
function Calls() {
827+
const [alwaysShowCallButton, setAlwaysShowCallButton] = useSetting(
828+
settingsAtom,
829+
'alwaysShowCallButton'
830+
);
831+
832+
return (
833+
<Box direction="Column" gap="100">
834+
<Text size="L400">Calls</Text>
835+
<SequenceCard className={SequenceCardStyle} variant="SurfaceVariant" direction="Column">
836+
<SettingTile
837+
title="Show Call Button for Large Rooms"
838+
after={
839+
<Switch
840+
variant="Primary"
841+
value={alwaysShowCallButton}
842+
onChange={setAlwaysShowCallButton}
843+
/>
844+
}
845+
/>
846+
</SequenceCard>
847+
</Box>
848+
);
849+
}
850+
826851
function Messages() {
827852
const [hideMembershipEvents, setHideMembershipEvents] = useSetting(
828853
settingsAtom,
@@ -1078,6 +1103,7 @@ export function General({ requestClose }: GeneralProps) {
10781103
<Gestures isMobile={mobileOrTablet()} />
10791104
<Editor isMobile={mobileOrTablet()} />
10801105
<Messages />
1106+
<Calls />
10811107
</Box>
10821108
</PageContent>
10831109
</Scroll>

src/app/state/settings.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ export interface Settings {
9696
autoplayStickers: boolean;
9797
autoplayEmojis: boolean;
9898
saveStickerEmojiBandwidth: boolean;
99+
alwaysShowCallButton: boolean;
99100

100101
// furry stuff
101102
renderAnimals: boolean;
@@ -176,6 +177,7 @@ const defaultSettings: Settings = {
176177
autoplayStickers: true,
177178
autoplayEmojis: true,
178179
saveStickerEmojiBandwidth: false,
180+
alwaysShowCallButton: false,
179181

180182
// furry stuff
181183
renderAnimals: true,

0 commit comments

Comments
 (0)