2022-01-05 10:30:27 +01:00
|
|
|
<script lang="typescript">
|
|
|
|
import { onMount } from "svelte";
|
|
|
|
|
|
|
|
import { ICON_URL } from "../../Enum/EnvironmentVariable";
|
2022-02-10 11:40:36 +01:00
|
|
|
import { coWebsitesNotAsleep, mainCoWebsite, jitsiCoWebsite } from "../../Stores/CoWebsiteStore";
|
2022-01-05 10:30:27 +01:00
|
|
|
import { highlightedEmbedScreen } from "../../Stores/EmbedScreensStore";
|
2022-02-10 11:40:36 +01:00
|
|
|
import type { CoWebsite } from "../../WebRtc/CoWebsite/CoWesbite";
|
2022-02-07 17:09:52 +01:00
|
|
|
import { iframeStates } from "../../WebRtc/CoWebsiteManager";
|
2022-01-05 10:30:27 +01:00
|
|
|
import { coWebsiteManager } from "../../WebRtc/CoWebsiteManager";
|
|
|
|
|
|
|
|
export let index: number;
|
|
|
|
export let coWebsite: CoWebsite;
|
|
|
|
export let vertical: boolean;
|
|
|
|
|
|
|
|
let icon: HTMLImageElement;
|
2022-01-27 15:59:19 +01:00
|
|
|
let iconLoaded = false;
|
2022-02-10 11:40:36 +01:00
|
|
|
let state = coWebsite.getStateSubscriber();
|
|
|
|
let isJitsi: boolean = false;
|
2022-01-05 10:30:27 +01:00
|
|
|
|
|
|
|
onMount(() => {
|
2022-02-10 11:40:36 +01:00
|
|
|
isJitsi = Boolean($jitsiCoWebsite && $jitsiCoWebsite.getId() === coWebsite.getId());
|
|
|
|
icon.src = isJitsi
|
2022-02-03 15:02:58 +01:00
|
|
|
? "/resources/logos/meet.svg"
|
2022-02-10 11:40:36 +01:00
|
|
|
: `${ICON_URL}/icon?url=${coWebsite.getUrl().hostname}&size=64..96..256&fallback_icon_color=14304c`;
|
|
|
|
icon.alt = coWebsite.getUrl().hostname;
|
2022-01-27 15:59:19 +01:00
|
|
|
icon.onload = () => {
|
|
|
|
iconLoaded = true;
|
|
|
|
};
|
2022-01-05 10:30:27 +01:00
|
|
|
});
|
|
|
|
|
2022-01-17 10:04:54 +01:00
|
|
|
async function onClick() {
|
2022-01-05 10:30:27 +01:00
|
|
|
if (vertical) {
|
|
|
|
coWebsiteManager.goToMain(coWebsite);
|
|
|
|
} else if ($mainCoWebsite) {
|
2022-02-10 11:40:36 +01:00
|
|
|
if ($mainCoWebsite.getId() === coWebsite.getId()) {
|
2022-01-17 10:04:54 +01:00
|
|
|
const coWebsites = $coWebsitesNotAsleep;
|
|
|
|
const newMain = $highlightedEmbedScreen ?? coWebsites.length > 1 ? coWebsites[1] : undefined;
|
2022-02-10 11:40:36 +01:00
|
|
|
if (newMain && newMain.getId() !== $mainCoWebsite.getId()) {
|
2022-02-03 15:20:30 +01:00
|
|
|
coWebsiteManager.goToMain(newMain);
|
2022-02-07 17:09:52 +01:00
|
|
|
} else if (coWebsiteManager.getMainState() === iframeStates.closed) {
|
|
|
|
coWebsiteManager.displayMain();
|
|
|
|
} else {
|
|
|
|
coWebsiteManager.hideMain();
|
2022-01-17 10:04:54 +01:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
highlightedEmbedScreen.toggleHighlight({
|
|
|
|
type: "cowebsite",
|
|
|
|
embed: coWebsite,
|
|
|
|
});
|
|
|
|
}
|
2022-01-05 10:30:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($state === "asleep") {
|
|
|
|
await coWebsiteManager.loadCoWebsite(coWebsite);
|
|
|
|
}
|
|
|
|
|
|
|
|
coWebsiteManager.resizeAllIframes();
|
|
|
|
}
|
|
|
|
|
|
|
|
function noDrag() {
|
|
|
|
return false;
|
|
|
|
}
|
2022-01-17 10:04:54 +01:00
|
|
|
|
|
|
|
let isHighlight: boolean = false;
|
|
|
|
let isMain: boolean = false;
|
|
|
|
$: {
|
2022-02-10 11:40:36 +01:00
|
|
|
isMain = $mainCoWebsite !== undefined && $mainCoWebsite.getId() === coWebsite.getId();
|
2022-01-17 10:04:54 +01:00
|
|
|
isHighlight =
|
|
|
|
$highlightedEmbedScreen !== null &&
|
|
|
|
$highlightedEmbedScreen.type === "cowebsite" &&
|
2022-02-10 11:40:36 +01:00
|
|
|
$highlightedEmbedScreen.embed.getId() === coWebsite.getId();
|
2022-01-17 10:04:54 +01:00
|
|
|
}
|
2022-01-05 10:30:27 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<div
|
|
|
|
id={"cowebsite-thumbnail-" + index}
|
2022-01-12 15:36:24 +01:00
|
|
|
class="cowebsite-thumbnail nes-pointer"
|
2022-01-05 10:30:27 +01:00
|
|
|
class:asleep={$state === "asleep"}
|
|
|
|
class:loading={$state === "loading"}
|
|
|
|
class:ready={$state === "ready"}
|
2022-01-17 10:04:54 +01:00
|
|
|
class:displayed={isMain || isHighlight}
|
2022-01-05 10:30:27 +01:00
|
|
|
class:vertical
|
2022-01-17 10:04:54 +01:00
|
|
|
on:click={onClick}
|
2022-01-05 10:30:27 +01:00
|
|
|
>
|
2022-01-27 15:59:19 +01:00
|
|
|
<img
|
|
|
|
class="cowebsite-icon noselect nes-pointer"
|
|
|
|
class:hide={!iconLoaded}
|
2022-02-10 11:40:36 +01:00
|
|
|
class:jitsi={isJitsi}
|
2022-01-27 15:59:19 +01:00
|
|
|
bind:this={icon}
|
|
|
|
on:dragstart|preventDefault={noDrag}
|
|
|
|
alt=""
|
|
|
|
/>
|
|
|
|
<svg
|
|
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
|
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
|
|
class="cowebsite-icon"
|
|
|
|
class:hide={iconLoaded}
|
|
|
|
style="margin: auto; background: rgba(0, 0, 0, 0) none repeat scroll 0% 0%; shape-rendering: auto;"
|
|
|
|
viewBox="0 0 100 100"
|
|
|
|
preserveAspectRatio="xMidYMid"
|
|
|
|
>
|
|
|
|
<rect x="19" y="19" width="20" height="20" fill="#14304c">
|
|
|
|
<animate
|
|
|
|
attributeName="fill"
|
|
|
|
values="#365dff;#14304c;#14304c"
|
|
|
|
keyTimes="0;0.125;1"
|
|
|
|
dur="1s"
|
|
|
|
repeatCount="indefinite"
|
|
|
|
begin="0s"
|
|
|
|
calcMode="discrete"
|
|
|
|
/>
|
|
|
|
</rect><rect x="40" y="19" width="20" height="20" fill="#14304c">
|
|
|
|
<animate
|
|
|
|
attributeName="fill"
|
|
|
|
values="#365dff;#14304c;#14304c"
|
|
|
|
keyTimes="0;0.125;1"
|
|
|
|
dur="1s"
|
|
|
|
repeatCount="indefinite"
|
|
|
|
begin="0.125s"
|
|
|
|
calcMode="discrete"
|
|
|
|
/>
|
|
|
|
</rect><rect x="61" y="19" width="20" height="20" fill="#14304c">
|
|
|
|
<animate
|
|
|
|
attributeName="fill"
|
|
|
|
values="#365dff;#14304c;#14304c"
|
|
|
|
keyTimes="0;0.125;1"
|
|
|
|
dur="1s"
|
|
|
|
repeatCount="indefinite"
|
|
|
|
begin="0.25s"
|
|
|
|
calcMode="discrete"
|
|
|
|
/>
|
|
|
|
</rect><rect x="19" y="40" width="20" height="20" fill="#14304c">
|
|
|
|
<animate
|
|
|
|
attributeName="fill"
|
|
|
|
values="#365dff;#14304c;#14304c"
|
|
|
|
keyTimes="0;0.125;1"
|
|
|
|
dur="1s"
|
|
|
|
repeatCount="indefinite"
|
|
|
|
begin="0.875s"
|
|
|
|
calcMode="discrete"
|
|
|
|
/>
|
|
|
|
</rect><rect x="61" y="40" width="20" height="20" fill="#14304c">
|
|
|
|
<animate
|
|
|
|
attributeName="fill"
|
|
|
|
values="#365dff;#14304c;#14304c"
|
|
|
|
keyTimes="0;0.125;1"
|
|
|
|
dur="1s"
|
|
|
|
repeatCount="indefinite"
|
|
|
|
begin="0.375s"
|
|
|
|
calcMode="discrete"
|
|
|
|
/>
|
|
|
|
</rect><rect x="19" y="61" width="20" height="20" fill="#14304c">
|
|
|
|
<animate
|
|
|
|
attributeName="fill"
|
|
|
|
values="#365dff;#14304c;#14304c"
|
|
|
|
keyTimes="0;0.125;1"
|
|
|
|
dur="1s"
|
|
|
|
repeatCount="indefinite"
|
|
|
|
begin="0.75s"
|
|
|
|
calcMode="discrete"
|
|
|
|
/>
|
|
|
|
</rect><rect x="40" y="61" width="20" height="20" fill="#14304c">
|
|
|
|
<animate
|
|
|
|
attributeName="fill"
|
|
|
|
values="#365dff;#14304c;#14304c"
|
|
|
|
keyTimes="0;0.125;1"
|
|
|
|
dur="1s"
|
|
|
|
repeatCount="indefinite"
|
|
|
|
begin="0.625s"
|
|
|
|
calcMode="discrete"
|
|
|
|
/>
|
|
|
|
</rect><rect x="61" y="61" width="20" height="20" fill="#14304c">
|
|
|
|
<animate
|
|
|
|
attributeName="fill"
|
|
|
|
values="#365dff;#14304c;#14304c"
|
|
|
|
keyTimes="0;0.125;1"
|
|
|
|
dur="1s"
|
|
|
|
repeatCount="indefinite"
|
|
|
|
begin="0.5s"
|
|
|
|
calcMode="discrete"
|
|
|
|
/>
|
|
|
|
</rect>
|
|
|
|
</svg>
|
2022-01-05 10:30:27 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
.cowebsite-thumbnail {
|
2022-01-12 15:36:24 +01:00
|
|
|
position: relative;
|
2022-01-05 10:30:27 +01:00
|
|
|
padding: 0;
|
|
|
|
background-color: rgba(#000000, 0.6);
|
2022-01-17 10:04:54 +01:00
|
|
|
margin: 12px;
|
2022-01-05 10:30:27 +01:00
|
|
|
margin-top: auto;
|
|
|
|
margin-bottom: auto;
|
|
|
|
|
2022-01-17 10:04:54 +01:00
|
|
|
&::before {
|
|
|
|
content: "";
|
|
|
|
position: absolute;
|
|
|
|
width: 58px;
|
|
|
|
height: 58px;
|
|
|
|
left: -8px;
|
|
|
|
top: -8px;
|
|
|
|
|
|
|
|
margin: 4px;
|
|
|
|
|
|
|
|
border-style: solid;
|
|
|
|
border-width: 4px;
|
|
|
|
border-image-slice: 3;
|
|
|
|
border-image-width: 3;
|
|
|
|
border-image-repeat: stretch;
|
|
|
|
border-image-source: url('data:image/svg+xml;utf8,<?xml version="1.0" encoding="UTF-8" ?><svg version="1.1" width="8" height="8" xmlns="http://www.w3.org/2000/svg"><path d="M3 1 h1 v1 h-1 z M4 1 h1 v1 h-1 z M2 2 h1 v1 h-1 z M5 2 h1 v1 h-1 z M1 3 h1 v1 h-1 z M6 3 h1 v1 h-1 z M1 4 h1 v1 h-1 z M6 4 h1 v1 h-1 z M2 5 h1 v1 h-1 z M5 5 h1 v1 h-1 z M3 6 h1 v1 h-1 z M4 6 h1 v1 h-1 z" fill="rgb(33,37,41)" /></svg>');
|
|
|
|
border-image-outset: 1;
|
2022-01-05 10:30:27 +01:00
|
|
|
}
|
|
|
|
|
2022-02-01 17:52:10 +01:00
|
|
|
&:not(.vertical) {
|
2022-02-01 18:42:07 +01:00
|
|
|
animation: bounce 0.35s ease 6 alternate;
|
2022-02-01 17:52:10 +01:00
|
|
|
}
|
|
|
|
|
2022-01-05 10:30:27 +01:00
|
|
|
&.vertical {
|
|
|
|
margin: 7px;
|
2022-01-17 10:04:54 +01:00
|
|
|
|
|
|
|
&::before {
|
|
|
|
width: 48px;
|
|
|
|
height: 48px;
|
|
|
|
}
|
|
|
|
|
2022-01-05 10:30:27 +01:00
|
|
|
.cowebsite-icon {
|
|
|
|
width: 40px;
|
|
|
|
height: 40px;
|
|
|
|
}
|
2022-02-01 17:52:10 +01:00
|
|
|
|
|
|
|
animation: shake 0.35s ease-in-out;
|
2022-01-05 10:30:27 +01:00
|
|
|
}
|
|
|
|
|
2022-01-17 10:04:54 +01:00
|
|
|
&.displayed {
|
|
|
|
&:not(.vertical) {
|
|
|
|
animation: activeThumbnail 300ms ease-in 0s forwards;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-05 10:30:27 +01:00
|
|
|
&.asleep {
|
|
|
|
filter: grayscale(100%);
|
|
|
|
--webkit-filter: grayscale(100%);
|
|
|
|
}
|
|
|
|
|
|
|
|
&.loading {
|
|
|
|
animation: 2500ms ease-in-out 0s infinite alternate backgroundLoading;
|
|
|
|
}
|
|
|
|
|
2022-01-17 10:04:54 +01:00
|
|
|
&.ready {
|
|
|
|
&::before {
|
|
|
|
border-image-source: url('data:image/svg+xml;utf8,<?xml version="1.0" encoding="UTF-8" ?><svg version="1.1" width="8" height="8" xmlns="http://www.w3.org/2000/svg"><path d="M3 1 h1 v1 h-1 z M4 1 h1 v1 h-1 z M2 2 h1 v1 h-1 z M5 2 h1 v1 h-1 z M1 3 h1 v1 h-1 z M6 3 h1 v1 h-1 z M1 4 h1 v1 h-1 z M6 4 h1 v1 h-1 z M2 5 h1 v1 h-1 z M5 5 h1 v1 h-1 z M3 6 h1 v1 h-1 z M4 6 h1 v1 h-1 z" fill="rgb(38, 74, 110)" /></svg>');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-05 10:30:27 +01:00
|
|
|
@keyframes backgroundLoading {
|
|
|
|
0% {
|
|
|
|
background-color: rgba(#000000, 0.6);
|
|
|
|
}
|
|
|
|
|
|
|
|
100% {
|
|
|
|
background-color: #25598e;
|
|
|
|
}
|
|
|
|
}
|
2022-01-17 10:04:54 +01:00
|
|
|
|
|
|
|
@keyframes activeThumbnail {
|
|
|
|
0% {
|
|
|
|
transform: translateY(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
100% {
|
|
|
|
transform: translateY(-15px);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-01 17:52:10 +01:00
|
|
|
@keyframes bounce {
|
|
|
|
from {
|
|
|
|
transform: translateY(0);
|
|
|
|
}
|
|
|
|
to {
|
|
|
|
transform: translateY(-15px);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@keyframes shake {
|
|
|
|
0% {
|
|
|
|
transform: translateX(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
20% {
|
|
|
|
transform: translateX(-10px);
|
|
|
|
}
|
|
|
|
|
|
|
|
40% {
|
|
|
|
transform: translateX(10px);
|
|
|
|
}
|
|
|
|
|
|
|
|
60% {
|
|
|
|
transform: translateX(-10px);
|
|
|
|
}
|
|
|
|
|
|
|
|
80% {
|
|
|
|
transform: translateX(10px);
|
|
|
|
}
|
|
|
|
|
|
|
|
100% {
|
|
|
|
transform: translateX(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-17 10:04:54 +01:00
|
|
|
.cowebsite-icon {
|
|
|
|
width: 50px;
|
|
|
|
height: 50px;
|
|
|
|
object-fit: cover;
|
2022-01-27 15:59:19 +01:00
|
|
|
|
|
|
|
&.hide {
|
|
|
|
display: none;
|
|
|
|
}
|
2022-02-03 15:02:58 +01:00
|
|
|
|
|
|
|
&.jitsi {
|
|
|
|
filter: invert(100%);
|
|
|
|
-webkit-filter: invert(100%);
|
|
|
|
padding: 7px;
|
|
|
|
}
|
2022-01-17 10:04:54 +01:00
|
|
|
}
|
2022-01-05 10:30:27 +01:00
|
|
|
}
|
|
|
|
</style>
|