mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-02-22 21:23:09 +01:00
add open featured communities as default config option
This commit is contained in:
parent
95abc8d281
commit
3927f60057
3 changed files with 11 additions and 4 deletions
|
@ -11,6 +11,7 @@
|
|||
"allowCustomHomeservers": true,
|
||||
|
||||
"featuredCommunities": {
|
||||
"openAsDefault": false,
|
||||
"spaces": [
|
||||
"#cinny-space:matrix.org",
|
||||
"#community:matrix.org",
|
||||
|
|
|
@ -6,6 +6,7 @@ export type ClientConfig = {
|
|||
allowCustomHomeservers?: boolean;
|
||||
|
||||
featuredCommunities?: {
|
||||
openAsDefault?: boolean;
|
||||
spaces?: string[];
|
||||
rooms?: string[];
|
||||
};
|
||||
|
|
|
@ -275,14 +275,19 @@ export function Explore() {
|
|||
|
||||
export function ExploreRedirect() {
|
||||
const navigate = useNavigate();
|
||||
const clientConfig = useClientConfig();
|
||||
|
||||
const mx = useMatrixClient();
|
||||
|
||||
useEffect(() => {
|
||||
const userId = mx.getUserId();
|
||||
const userServer = userId ? getMxIdServer(userId) : undefined;
|
||||
if (userServer) navigate(getExploreServerPath(userServer), { replace: true });
|
||||
}, [navigate, mx]);
|
||||
if (clientConfig.featuredCommunities?.openAsDefault) {
|
||||
navigate(getExploreFeaturedPath(), { replace: true });
|
||||
} else {
|
||||
const userId = mx.getUserId();
|
||||
const userServer = userId ? getMxIdServer(userId) : undefined;
|
||||
if (userServer) navigate(getExploreServerPath(userServer), { replace: true });
|
||||
}
|
||||
}, [navigate, mx, clientConfig]);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue