Merge session icons together.

This commit is contained in:
Paul 2021-07-08 14:07:25 +01:00
parent f0fccac355
commit 594980fdac
2 changed files with 86 additions and 69 deletions

View file

@ -12,6 +12,10 @@ export default function Masks() {
<rect x="0" y="0" width="32" height="32" fill="white" />
<circle cx="27" cy="27" r="7" fill={"black"} />
</mask>
<mask id="session">
<rect x="0" y="0" width="32" height="32" fill="white" />
<circle cx="26" cy="30" r="12" fill={"black"} />
</mask>
<mask id="overlap">
<rect x="0" y="0" width="32" height="32" fill="white" />
<circle cx="32" cy="16" r="18" fill={"black"} />

View file

@ -66,15 +66,15 @@ export function Sessions() {
const name = session.friendly_name;
switch (true) {
case /firefox/i.test(name):
return <Firefoxbrowser />;
return <Firefoxbrowser size={32} />;
case /chrome/i.test(name):
return <Googlechrome />;
return <Googlechrome size={32} />;
case /safari/i.test(name):
return <Safari />;
return <Safari size={32} />;
case /edge/i.test(name):
return <Microsoftedge />;
return <Microsoftedge size={32} />;
default:
return <HelpCircle />;
return <HelpCircle size={32} />;
}
}
@ -82,15 +82,15 @@ export function Sessions() {
const name = session.friendly_name;
switch (true) {
case /linux/i.test(name):
return <Linux />;
return <Linux size={14} />;
case /android/i.test(name):
return <Android />;
return <Android size={14} />;
case /mac.*os/i.test(name):
return <Macos />;
return <Macos size={14} />;
case /ios/i.test(name):
return <Ios />;
return <Ios size={14} />;
case /windows/i.test(name):
return <Windows />;
return <Windows size={14} />;
default:
return null;
}
@ -117,7 +117,9 @@ export function Sessions() {
<h3>
<Text id="app.settings.pages.sessions.active_sessions" />
</h3>
{render.map((session) => (
{render.map((session) => {
const systemIcon = getSystemIcon(session);
return (
<div
className={styles.entry}
data-active={session.id === deviceId}
@ -129,17 +131,27 @@ export function Sessions() {
)}
<div className={styles.session}>
<div className={styles.detail}>
<div className={styles.icon}>
<svg width={42} height={42}
viewBox="0 0 32 32">
<foreignObject
x="0"
y="0"
width="32"
height="32"
mask={systemIcon ? "url(#session)": undefined}>
{getIcon(session)}
<div>{getSystemIcon(session)}</div>
</div>
</foreignObject>
<foreignObject x="18" y="18" width="14" height="14">
{ systemIcon }
</foreignObject>
</svg>
<div className={styles.info}>
<input
type="text"
className={styles.name}
value={session.friendly_name}
autocomplete="off"
/>
style={{ pointerEvents: 'none' }} />
<span className={styles.time}>
<Text
id="app.settings.pages.sessions.created"
@ -177,7 +189,8 @@ export function Sessions() {
)}
</div>
</div>
))}
)
})}
<Button error>
<Text id="app.settings.pages.sessions.logout" />
</Button>