Add join rle to icon src util function

Signed-off-by: ajbura <ajbura@gmail.com>
This commit is contained in:
ajbura 2022-02-16 19:52:51 +05:30
parent 76cb52878c
commit 189dc93a6e
3 changed files with 20 additions and 26 deletions

View file

@ -1,5 +1,12 @@
import initMatrix from '../client/initMatrix';
import HashIC from '../../public/res/ic/outlined/hash.svg';
import HashGlobeIC from '../../public/res/ic/outlined/hash-globe.svg';
import HashLockIC from '../../public/res/ic/outlined/hash-lock.svg';
import SpaceIC from '../../public/res/ic/outlined/space.svg';
import SpaceGlobeIC from '../../public/res/ic/outlined/space-globe.svg';
import SpaceLockIC from '../../public/res/ic/outlined/space-lock.svg';
const WELL_KNOWN_URI = '/.well-known/matrix/client';
async function getBaseUrl(servername) {
@ -86,8 +93,16 @@ function hasDMWith(userId) {
});
}
function joinRuleToIconSrc(joinRule, isSpace) {
return ({
restricted: () => (isSpace ? SpaceIC : HashIC),
invite: () => (isSpace ? SpaceLockIC : HashLockIC),
public: () => (isSpace ? SpaceGlobeIC : HashGlobeIC),
}[joinRule]?.() || null);
}
export {
getBaseUrl, getUsername, getUsernameOfRoomMember,
isRoomAliasAvailable, getPowerLabel, parseReply,
hasDMWith,
hasDMWith, joinRuleToIconSrc,
};