2018-07-06 18:15:15 +00:00
|
|
|
<template>
|
|
|
|
<div
|
|
|
|
id="viewport"
|
2019-02-25 05:38:13 +00:00
|
|
|
role="tablist"
|
|
|
|
>
|
2018-07-06 18:15:15 +00:00
|
|
|
<aside id="sidebar">
|
|
|
|
<div class="scrollable-area">
|
|
|
|
<div class="logo-container">
|
|
|
|
<img
|
|
|
|
:src="`img/logo-${isPublic() ? 'horizontal-' : ''}transparent-bg.svg`"
|
|
|
|
class="logo"
|
2019-02-25 05:38:13 +00:00
|
|
|
alt="The Lounge"
|
|
|
|
>
|
2018-07-06 18:15:15 +00:00
|
|
|
<img
|
|
|
|
:src="`img/logo-${isPublic() ? 'horizontal-' : ''}transparent-bg-inverted.svg`"
|
|
|
|
class="logo-inverted"
|
2019-02-25 05:38:13 +00:00
|
|
|
alt="The Lounge"
|
|
|
|
>
|
2018-07-06 18:15:15 +00:00
|
|
|
</div>
|
2018-07-12 19:24:35 +00:00
|
|
|
<NetworkList
|
2018-07-06 18:15:15 +00:00
|
|
|
:networks="networks"
|
2019-02-25 05:38:13 +00:00
|
|
|
:active-channel="activeChannel"
|
|
|
|
/>
|
2018-07-06 18:15:15 +00:00
|
|
|
</div>
|
|
|
|
<footer id="footer">
|
|
|
|
<span
|
|
|
|
class="tooltipped tooltipped-n tooltipped-no-touch"
|
2019-02-25 05:38:13 +00:00
|
|
|
aria-label="Sign in"
|
|
|
|
><button
|
|
|
|
class="icon sign-in"
|
|
|
|
data-target="#sign-in"
|
|
|
|
aria-label="Sign in"
|
|
|
|
role="tab"
|
|
|
|
aria-controls="sign-in"
|
|
|
|
aria-selected="false"
|
|
|
|
/></span>
|
2018-07-06 18:15:15 +00:00
|
|
|
<span
|
|
|
|
class="tooltipped tooltipped-n tooltipped-no-touch"
|
2019-02-25 05:38:13 +00:00
|
|
|
aria-label="Connect to network"
|
|
|
|
><button
|
|
|
|
class="icon connect"
|
|
|
|
data-target="#connect"
|
|
|
|
aria-label="Connect to network"
|
|
|
|
role="tab"
|
|
|
|
aria-controls="connect"
|
|
|
|
aria-selected="false"
|
|
|
|
/></span>
|
2018-07-06 18:15:15 +00:00
|
|
|
<span
|
|
|
|
class="tooltipped tooltipped-n tooltipped-no-touch"
|
2019-02-25 05:38:13 +00:00
|
|
|
aria-label="Settings"
|
|
|
|
><button
|
|
|
|
class="icon settings"
|
|
|
|
data-target="#settings"
|
|
|
|
aria-label="Settings"
|
|
|
|
role="tab"
|
|
|
|
aria-controls="settings"
|
|
|
|
aria-selected="false"
|
|
|
|
/></span>
|
2018-07-06 18:15:15 +00:00
|
|
|
<span
|
|
|
|
class="tooltipped tooltipped-n tooltipped-no-touch"
|
2019-02-25 05:38:13 +00:00
|
|
|
aria-label="Help"
|
|
|
|
><button
|
|
|
|
class="icon help"
|
|
|
|
data-target="#help"
|
|
|
|
aria-label="Help"
|
|
|
|
role="tab"
|
|
|
|
aria-controls="help"
|
|
|
|
aria-selected="false"
|
|
|
|
/></span>
|
2018-07-06 18:15:15 +00:00
|
|
|
</footer>
|
|
|
|
</aside>
|
2018-07-29 17:57:14 +00:00
|
|
|
<div id="sidebar-overlay" />
|
2018-07-06 18:15:15 +00:00
|
|
|
<article id="windows">
|
2018-07-08 13:42:54 +00:00
|
|
|
<Chat
|
|
|
|
v-if="activeChannel"
|
|
|
|
:network="activeChannel.network"
|
2019-02-25 05:38:13 +00:00
|
|
|
:channel="activeChannel.channel"
|
|
|
|
/>
|
2018-07-06 18:15:15 +00:00
|
|
|
<div
|
|
|
|
id="sign-in"
|
|
|
|
class="window"
|
|
|
|
role="tabpanel"
|
2019-02-25 05:38:13 +00:00
|
|
|
aria-label="Sign-in"
|
|
|
|
/>
|
2018-07-06 18:15:15 +00:00
|
|
|
<div
|
|
|
|
id="connect"
|
|
|
|
class="window"
|
|
|
|
role="tabpanel"
|
2019-02-25 05:38:13 +00:00
|
|
|
aria-label="Connect"
|
|
|
|
/>
|
2018-07-06 18:15:15 +00:00
|
|
|
<div
|
|
|
|
id="settings"
|
|
|
|
class="window"
|
|
|
|
role="tabpanel"
|
2019-02-25 05:38:13 +00:00
|
|
|
aria-label="Settings"
|
|
|
|
/>
|
2018-07-06 18:15:15 +00:00
|
|
|
<div
|
|
|
|
id="help"
|
|
|
|
class="window"
|
|
|
|
role="tabpanel"
|
2019-02-25 05:38:13 +00:00
|
|
|
aria-label="Help"
|
|
|
|
/>
|
2018-07-06 18:15:15 +00:00
|
|
|
<div
|
|
|
|
id="changelog"
|
|
|
|
class="window"
|
2019-02-25 05:38:13 +00:00
|
|
|
aria-label="Changelog"
|
|
|
|
/>
|
2018-07-06 18:15:15 +00:00
|
|
|
</article>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2018-09-20 08:36:55 +00:00
|
|
|
const throttle = require("lodash/throttle");
|
2018-08-31 18:15:46 +00:00
|
|
|
|
2018-07-12 19:24:35 +00:00
|
|
|
import NetworkList from "./NetworkList.vue";
|
2018-07-08 10:50:11 +00:00
|
|
|
import Chat from "./Chat.vue";
|
2018-07-06 18:15:15 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: "App",
|
|
|
|
components: {
|
2018-07-12 19:24:35 +00:00
|
|
|
NetworkList,
|
2018-07-08 10:50:11 +00:00
|
|
|
Chat,
|
2018-07-06 18:15:15 +00:00
|
|
|
},
|
|
|
|
props: {
|
|
|
|
activeChannel: Object,
|
|
|
|
networks: Array,
|
|
|
|
},
|
2018-08-31 18:15:46 +00:00
|
|
|
mounted() {
|
|
|
|
// Make a single throttled resize listener available to all components
|
|
|
|
this.debouncedResize = throttle(() => {
|
2018-08-31 18:37:39 +00:00
|
|
|
this.$root.$emit("resize");
|
2018-08-31 18:15:46 +00:00
|
|
|
}, 100);
|
|
|
|
|
|
|
|
window.addEventListener("resize", this.debouncedResize, {passive: true});
|
2018-09-12 17:14:45 +00:00
|
|
|
|
|
|
|
// Emit a daychange event every time the day changes so date markers know when to update themselves
|
|
|
|
const emitDayChange = () => {
|
|
|
|
this.$root.$emit("daychange");
|
|
|
|
// This should always be 24h later but re-computing exact value just in case
|
|
|
|
this.dayChangeTimeout = setTimeout(emitDayChange, this.msUntilNextDay());
|
|
|
|
};
|
|
|
|
|
|
|
|
this.dayChangeTimeout = setTimeout(emitDayChange, this.msUntilNextDay());
|
2018-08-31 18:15:46 +00:00
|
|
|
},
|
|
|
|
beforeDestroy() {
|
|
|
|
window.removeEventListener("resize", this.debouncedResize);
|
2018-09-12 17:14:45 +00:00
|
|
|
clearTimeout(this.dayChangeTimeout);
|
2018-08-31 18:15:46 +00:00
|
|
|
},
|
2018-08-31 18:37:39 +00:00
|
|
|
methods: {
|
|
|
|
isPublic: () => document.body.classList.contains("public"),
|
2018-09-12 17:14:45 +00:00
|
|
|
msUntilNextDay() {
|
|
|
|
// Compute how many milliseconds are remaining until the next day starts
|
2018-09-20 07:50:00 +00:00
|
|
|
const today = new Date();
|
|
|
|
const tommorow = new Date(today.getFullYear(), today.getMonth(), today.getDate() + 1);
|
|
|
|
|
|
|
|
return tommorow - today;
|
2018-09-12 17:14:45 +00:00
|
|
|
},
|
2018-08-31 18:37:39 +00:00
|
|
|
},
|
2018-07-06 18:15:15 +00:00
|
|
|
};
|
|
|
|
</script>
|