diff --git a/client/components/App.vue b/client/components/App.vue index d20f414b..d58e819f 100644 --- a/client/components/App.vue +++ b/client/components/App.vue @@ -62,7 +62,15 @@
-
+
+ + +
import Network from "./Network.vue"; +import Chat from "./Chat.vue"; export default { name: "App", components: { Network, + Chat, }, props: { activeChannel: Object, diff --git a/client/components/Chat.vue b/client/components/Chat.vue new file mode 100644 index 00000000..97fd7cb8 --- /dev/null +++ b/client/components/Chat.vue @@ -0,0 +1,111 @@ + + + diff --git a/client/components/Message.vue b/client/components/Message.vue new file mode 100644 index 00000000..5c277a17 --- /dev/null +++ b/client/components/Message.vue @@ -0,0 +1,53 @@ + + + diff --git a/client/components/Username.vue b/client/components/Username.vue new file mode 100644 index 00000000..b3ebeff0 --- /dev/null +++ b/client/components/Username.vue @@ -0,0 +1,15 @@ + + + diff --git a/client/js/render.js b/client/js/render.js index 395c7270..e65057fc 100644 --- a/client/js/render.js +++ b/client/js/render.js @@ -148,7 +148,7 @@ function renderChannel(data) { function renderChannelMessages(data) { const documentFragment = buildChannelMessages($(document.createDocumentFragment()), data.id, data.type, data.messages); - const channel = chat.find("#chan-" + data.id + " .messages").append(documentFragment); + const channel = chat.find("#chan-" + data.id + " .messages"); renderUnreadMarker($(templates.unread_marker()), data.firstUnread, channel); } @@ -264,12 +264,6 @@ function renderNetworks(data, singleNetwork) { } if (newChannels.length > 0) { - chat.append( - templates.chat({ - channels: newChannels, - }) - ); - newChannels.forEach((channel) => { renderChannel(channel); diff --git a/client/js/socket-events/join.js b/client/js/socket-events/join.js index c1243840..bd595d7c 100644 --- a/client/js/socket-events/join.js +++ b/client/js/socket-events/join.js @@ -3,7 +3,6 @@ const $ = require("jquery"); const socket = require("../socket"); const render = require("../render"); -const chat = $("#chat"); const templates = require("../../views"); const sidebar = $("#sidebar"); const {Vue, vueApp} = require("../vue"); @@ -12,12 +11,6 @@ socket.on("join", function(data) { vueApp.networks.find((n) => n.uuid === data.network) .channels.splice(data.index || -1, 0, data.chan); - chat.append( - templates.chat({ - channels: [data.chan], - }) - ); - Vue.nextTick(() => render.renderChannel(data.chan)); // Queries do not automatically focus, unless the user did a whois diff --git a/client/js/socket-events/part.js b/client/js/socket-events/part.js index bbf0dfd9..0c2bc327 100644 --- a/client/js/socket-events/part.js +++ b/client/js/socket-events/part.js @@ -13,8 +13,6 @@ socket.on("part", function(data) { .trigger("click"); } - $("#chan-" + data.chan).remove(); - const network = vueApp.networks.find((n) => n.uuid === data.network); network.channels.splice(network.channels.findIndex((c) => c.id === data.chan), 1); }); diff --git a/client/js/socket-events/quit.js b/client/js/socket-events/quit.js index ab7f7703..2c6256c9 100644 --- a/client/js/socket-events/quit.js +++ b/client/js/socket-events/quit.js @@ -1,7 +1,6 @@ "use strict"; const $ = require("jquery"); -const chat = $("#chat"); const socket = require("../socket"); const sidebar = $("#sidebar"); const {Vue, vueApp} = require("../vue"); @@ -9,14 +8,6 @@ const {Vue, vueApp} = require("../vue"); socket.on("quit", function(data) { vueApp.networks.splice(vueApp.networks.findIndex((n) => n.uuid === data.network), 1); - const id = data.network; - const network = sidebar.find(`.network[data-uuid="${id}"]`); - - network.children(".chan").each(function() { - // this = child - chat.find($(this).attr("data-target")).remove(); - }); - Vue.nextTick(() => { const chan = sidebar.find(".chan"); diff --git a/client/js/vue.js b/client/js/vue.js index a00ad7b8..a6b7a3df 100644 --- a/client/js/vue.js +++ b/client/js/vue.js @@ -3,7 +3,19 @@ const Vue = require("vue").default; const App = require("../components/App.vue").default; const roundBadgeNumber = require("./libs/handlebars/roundBadgeNumber"); +const parse = require("./libs/handlebars/parse"); +const tz = require("./libs/handlebars/tz"); +const localetime = require("./libs/handlebars/localetime"); +const localedate = require("./libs/handlebars/localedate"); +const friendlydate = require("./libs/handlebars/friendlydate"); +const colorClass = require("./libs/handlebars/colorClass"); +Vue.filter("parse", parse); +Vue.filter("tz", tz); +Vue.filter("localetime", localetime); +Vue.filter("localedate", localedate); +Vue.filter("friendlydate", friendlydate); +Vue.filter("colorClass", colorClass); Vue.filter("roundBadgeNumber", roundBadgeNumber); const vueApp = new Vue({ diff --git a/client/views/chat.tpl b/client/views/chat.tpl deleted file mode 100644 index 88346f9a..00000000 --- a/client/views/chat.tpl +++ /dev/null @@ -1,39 +0,0 @@ -{{#each channels}} -
-
- - {{name}} - {{{parse topic}}} - - {{#equal type "channel"}} - - - - {{/equal}} -
-
-
-
- -
-
-
- {{#equal type "channel"}} - - {{/equal}} -
-
-{{/each}} diff --git a/client/views/msg.tpl b/client/views/msg.tpl deleted file mode 100644 index 05b818ac..00000000 --- a/client/views/msg.tpl +++ /dev/null @@ -1,17 +0,0 @@ -
- - {{tz time}} - - - {{#if from.nick}} - {{> user_name from}} - {{/if}} - - - {{{parse text users}}} - - {{#each previews}} -
- {{/each}} -
-
diff --git a/client/views/msg_unhandled.tpl b/client/views/msg_unhandled.tpl deleted file mode 100644 index b1f9dcec..00000000 --- a/client/views/msg_unhandled.tpl +++ /dev/null @@ -1,11 +0,0 @@ -
- - {{tz time}} - - [{{command}}] - - {{#each params}} - {{this}} - {{/each}} - -