Apply requested changes

This commit is contained in:
Ginger 2025-04-07 12:36:33 -04:00
parent e2974d386e
commit d3fac3bf94
3 changed files with 12 additions and 13 deletions

View file

@ -11,7 +11,7 @@ export const useExploreSelected = (): boolean => {
return !!match; return !!match;
}; };
export const useExploringFeaturedRooms = (): boolean => { export const useExploreFeaturedRooms = (): boolean => {
const match = useMatch({ const match = useMatch({
path: getExploreFeaturedPath(), path: getExploreFeaturedPath(),
caseSensitive: true, caseSensitive: true,

View file

@ -32,7 +32,7 @@ import {
import { getExploreFeaturedPath, getExploreServerPath } from '../../pathUtils'; import { getExploreFeaturedPath, getExploreServerPath } from '../../pathUtils';
import { useClientConfig } from '../../../hooks/useClientConfig'; import { useClientConfig } from '../../../hooks/useClientConfig';
import { import {
useExploringFeaturedRooms, useExploreFeaturedRooms,
useExploreServer, useExploreServer,
} from '../../../hooks/router/useExploreSelected'; } from '../../../hooks/router/useExploreSelected';
import { useMatrixClient } from '../../../hooks/useMatrixClient'; import { useMatrixClient } from '../../../hooks/useMatrixClient';
@ -42,6 +42,7 @@ import { useNavToActivePathMapper } from '../../../hooks/useNavToActivePathMappe
import { PageNav, PageNavContent, PageNavHeader } from '../../../components/page'; import { PageNav, PageNavContent, PageNavHeader } from '../../../components/page';
import { stopPropagation } from '../../../utils/keyboard'; import { stopPropagation } from '../../../utils/keyboard';
import { useExploreServers } from '../../../hooks/useExploreServers'; import { useExploreServers } from '../../../hooks/useExploreServers';
import { useAlive } from '../../../hooks/useAlive';
type AddExploreServerPromptProps = { type AddExploreServerPromptProps = {
onSubmit: (server: string) => Promise<void>; onSubmit: (server: string) => Promise<void>;
@ -57,6 +58,7 @@ export function AddExploreServerPrompt({
}: AddExploreServerPromptProps) { }: AddExploreServerPromptProps) {
const mx = useMatrixClient(); const mx = useMatrixClient();
const [dialog, setDialog] = useState(false); const [dialog, setDialog] = useState(false);
const alive = useAlive();
const serverInputRef = useRef<HTMLInputElement>(null); const serverInputRef = useRef<HTMLInputElement>(null);
const getInputServer = (): string | undefined => { const getInputServer = (): string | undefined => {
@ -73,8 +75,10 @@ export function AddExploreServerPrompt({
await mx.publicRooms({ server, limit: 1 }); await mx.publicRooms({ server, limit: 1 });
await onSubmit(server); await onSubmit(server);
if (alive()) {
setDialog(false); setDialog(false);
}, [onSubmit, mx]) }
}, [alive, onSubmit, mx])
); );
return ( return (
@ -235,7 +239,7 @@ export function Explore() {
const [exploreServers, addServer, removeServer] = useExploreServers(); const [exploreServers, addServer, removeServer] = useExploreServers();
const selectedServer = useExploreServer(); const selectedServer = useExploreServer();
const exploringFeaturedRooms = useExploringFeaturedRooms(); const exploringFeaturedRooms = useExploreFeaturedRooms();
const exploringUnlistedServer = useMemo( const exploringUnlistedServer = useMemo(
() => () =>
selectedServer !== undefined && selectedServer !== undefined &&

View file

@ -527,18 +527,13 @@ export function PublicRooms() {
</BackRouteHandler> </BackRouteHandler>
)} )}
</Box> </Box>
<Box grow="Yes" justifyContent="Center" alignItems="Center" gap="200"> <Box grow="Yes" basis="Yes" justifyContent="Center" alignItems="Center" gap="200">
{screenSize !== ScreenSize.Mobile && <Icon size="400" src={Icons.Category} />} {screenSize !== ScreenSize.Mobile && <Icon size="400" src={Icons.Category} />}
<Text size="H3" truncate> <Text size="H3" truncate>
{server} {server}
</Text> </Text>
</Box> </Box>
<Box <Box shrink="No" grow="Yes" basis="No" justifyContent="End">
shrink="No"
grow={screenSize === ScreenSize.Mobile ? 'No' : 'Yes'}
basis={screenSize === ScreenSize.Mobile ? 'Yes' : 'No'}
justifyContent="End"
>
<TooltipProvider <TooltipProvider
position="Bottom" position="Bottom"
align="End" align="End"
@ -588,7 +583,7 @@ export function PublicRooms() {
isRemoving ? ( isRemoving ? (
<Spinner fill="Solid" variant="Secondary" size="200" /> <Spinner fill="Solid" variant="Secondary" size="200" />
) : ( ) : (
<Icon size="100" src={Icons.Minus} /> <Icon size="100" src={Icons.Delete} />
) )
} }
radii="300" radii="300"