mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-02-23 13:43:07 +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,
|
"allowCustomHomeservers": true,
|
||||||
|
|
||||||
"featuredCommunities": {
|
"featuredCommunities": {
|
||||||
|
"openAsDefault": false,
|
||||||
"spaces": [
|
"spaces": [
|
||||||
"#cinny-space:matrix.org",
|
"#cinny-space:matrix.org",
|
||||||
"#community:matrix.org",
|
"#community:matrix.org",
|
||||||
|
|
|
@ -6,6 +6,7 @@ export type ClientConfig = {
|
||||||
allowCustomHomeservers?: boolean;
|
allowCustomHomeservers?: boolean;
|
||||||
|
|
||||||
featuredCommunities?: {
|
featuredCommunities?: {
|
||||||
|
openAsDefault?: boolean;
|
||||||
spaces?: string[];
|
spaces?: string[];
|
||||||
rooms?: string[];
|
rooms?: string[];
|
||||||
};
|
};
|
||||||
|
|
|
@ -275,14 +275,19 @@ export function Explore() {
|
||||||
|
|
||||||
export function ExploreRedirect() {
|
export function ExploreRedirect() {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
const clientConfig = useClientConfig();
|
||||||
|
|
||||||
const mx = useMatrixClient();
|
const mx = useMatrixClient();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (clientConfig.featuredCommunities?.openAsDefault) {
|
||||||
|
navigate(getExploreFeaturedPath(), { replace: true });
|
||||||
|
} else {
|
||||||
const userId = mx.getUserId();
|
const userId = mx.getUserId();
|
||||||
const userServer = userId ? getMxIdServer(userId) : undefined;
|
const userServer = userId ? getMxIdServer(userId) : undefined;
|
||||||
if (userServer) navigate(getExploreServerPath(userServer), { replace: true });
|
if (userServer) navigate(getExploreServerPath(userServer), { replace: true });
|
||||||
}, [navigate, mx]);
|
}
|
||||||
|
}, [navigate, mx, clientConfig]);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue