Merge branch 'master' of https://github.com/hackersanddesigners/chatty-pub
This commit is contained in:
commit
1c8921dff3
9 changed files with 93 additions and 23 deletions
0
Icon
0
Icon
|
|
@ -1,3 +0,0 @@
|
||||||
VUE_APP_ZULIP_email=pub-bot@chat.hackersanddesigners.nl
|
|
||||||
VUE_APP_ZULIP_key=m1MDxscGcPQx2RvIfgG4DiSHE1nurxms
|
|
||||||
VUE_APP_ZULIP_site=https://chat.hackersanddesigners.nl
|
|
||||||
1
front/.gitignore
vendored
1
front/.gitignore
vendored
|
|
@ -6,6 +6,7 @@ node_modules
|
||||||
# local env files
|
# local env files
|
||||||
.env.local
|
.env.local
|
||||||
.env.*.local
|
.env.*.local
|
||||||
|
.env
|
||||||
|
|
||||||
# Log files
|
# Log files
|
||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
|
|
|
||||||
|
|
@ -189,13 +189,6 @@ section p {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
section .title {
|
|
||||||
display: none;
|
|
||||||
font-weight: bold;
|
|
||||||
position: sticky;
|
|
||||||
top: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media print {
|
@media print {
|
||||||
.title {
|
.title {
|
||||||
display: none;
|
display: none;
|
||||||
|
|
|
||||||
50
front/src/components/Content/Chapter.vue
Normal file
50
front/src/components/Content/Chapter.vue
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
<template>
|
||||||
|
<div :class="[ 'body', topic.title ]">
|
||||||
|
<h3
|
||||||
|
@click="desiresContent = !desiresContent"
|
||||||
|
class="header"
|
||||||
|
>
|
||||||
|
<span class="expandToggle">{{ desiresContent ? '▼ ' : '► '}}</span>
|
||||||
|
<span>{{ topic.title }}</span>
|
||||||
|
</h3>
|
||||||
|
<div v-if="desiresContent">
|
||||||
|
<span
|
||||||
|
v-for="message in topic.messages"
|
||||||
|
:key="message.id"
|
||||||
|
>
|
||||||
|
<Message
|
||||||
|
:message="message"
|
||||||
|
/>
|
||||||
|
<span> </span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import Message from './Message'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'Chapter',
|
||||||
|
components: {
|
||||||
|
Message,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
desiresContent: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
props: [
|
||||||
|
'topic',
|
||||||
|
],
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.header {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
@media print {
|
||||||
|
.title { display: none; }
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<section class="rules">
|
<section class="rules">
|
||||||
<p class="title">{{ $.type.name }}</p>
|
<!-- <p class="title">{{ $.type.name }}</p> -->
|
||||||
<Rule
|
<Rule
|
||||||
v-for="rule in rules"
|
v-for="rule in rules"
|
||||||
:key="rule.id"
|
:key="rule.id"
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div :class="{ selected: selected }">
|
||||||
<p class="name">
|
<p class="name">
|
||||||
<router-link :to="stream.name">
|
<router-link :to="stream.name">
|
||||||
{{ stream.name }}
|
{{ stream.name }}
|
||||||
|
|
@ -16,15 +16,21 @@ export default {
|
||||||
'stream'
|
'stream'
|
||||||
],
|
],
|
||||||
computed: {
|
computed: {
|
||||||
|
selected() { return this.$store.state.currentStream == this.stream.name }
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
div {
|
div {
|
||||||
|
padding: 0.5em;
|
||||||
|
}
|
||||||
|
div .selected {
|
||||||
|
background: rgb(247, 146, 247);
|
||||||
}
|
}
|
||||||
div p {
|
div p {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<section class="streams">
|
<section class="streams">
|
||||||
<p class="title">{{ $.type.name }}</p>
|
<!-- <p class="title">{{ $.type.name }}</p> -->
|
||||||
<Stream
|
<Stream
|
||||||
v-for="stream in streams"
|
v-for="stream in streams"
|
||||||
:key="stream.id"
|
:key="stream.id"
|
||||||
|
|
@ -29,6 +29,7 @@ export default {
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.streams {
|
.streams {
|
||||||
min-width: 10em;
|
min-width: 10em;
|
||||||
|
padding: 0;
|
||||||
}
|
}
|
||||||
@media print {
|
@media print {
|
||||||
.streams { display: none; }
|
.streams { display: none; }
|
||||||
|
|
|
||||||
|
|
@ -115,20 +115,29 @@ export default createStore({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
deleteMessage: (state, mid) => {
|
deleteMessage: (state, { mid, subject }) => {
|
||||||
const message = state.contents.find(m => m.id == mid)
|
const topic = state.topics.find(t => t.title == subject)
|
||||||
|
if (topic) {
|
||||||
|
const message = topic.messages.find(m => m.id == mid)
|
||||||
if (message) {
|
if (message) {
|
||||||
state.contents.splice(state.contents.indexOf(message), 1)
|
topic.messages.splice(topic.messages.indexOf(message), 1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
addReaction: (state, { mid, reaction }) => {
|
addReaction: (state, { mid, reaction }) => {
|
||||||
const message = state.contents.find(m => m.id == mid)
|
const message = state.topics
|
||||||
|
.map(t => t.messages)
|
||||||
|
.flat()
|
||||||
|
.find(m => m.id == mid)
|
||||||
if (message) {
|
if (message) {
|
||||||
message.reactions.push(reaction)
|
message.reactions.push(reaction)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
removeReaction: (state, { mid, reaction }) => {
|
removeReaction: (state, { mid, reaction }) => {
|
||||||
const message = state.contents.find(m => m.id == mid)
|
const message = state.topics
|
||||||
|
.map(t => t.messages)
|
||||||
|
.flat()
|
||||||
|
.find(m => m.id == mid)
|
||||||
if (message) {
|
if (message) {
|
||||||
message.reactions.splice(message.reactions.indexOf(reaction), 1)
|
message.reactions.splice(message.reactions.indexOf(reaction), 1)
|
||||||
}
|
}
|
||||||
|
|
@ -145,13 +154,15 @@ export default createStore({
|
||||||
addRule: (state, rule) => {
|
addRule: (state, rule) => {
|
||||||
if (toCSS(rule) !== null) {
|
if (toCSS(rule) !== null) {
|
||||||
// state.rules.push(toCSS(rule, state.currentStream))
|
// state.rules.push(toCSS(rule, state.currentStream))
|
||||||
|
|
||||||
// vue will not update if i use rules.push(rule)
|
// vue will not update if i use rules.push(rule)
|
||||||
state.rules = [...state.rules,...[toCSS(rule, state.currentStream)]]
|
state.rules = [...state.rules,...[toCSS(rule, state.currentStream)]]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
editMessage: (state, { mid, content }) => {
|
editMessage: (state, { mid, content }) => {
|
||||||
const message = state.contents.find(m => m.id == mid)
|
const message = state.topics
|
||||||
|
.map(t => t.messages)
|
||||||
|
.flat()
|
||||||
|
.find(m => m.id == mid)
|
||||||
const rule = state.rules.find(r => r.id == mid)
|
const rule = state.rules.find(r => r.id == mid)
|
||||||
if (message) {
|
if (message) {
|
||||||
message.content = content
|
message.content = content
|
||||||
|
|
@ -173,10 +184,17 @@ export default createStore({
|
||||||
id: mid, content: content,
|
id: mid, content: content,
|
||||||
}, state.currentStream)]]
|
}, state.currentStream)]]
|
||||||
state.rules = newRules
|
state.rules = newRules
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
updateTopic: (state, { orig_subject, subject }) => {
|
||||||
|
const topic = state.topics.find(t => t.title == orig_subject)
|
||||||
|
if (topic) {
|
||||||
|
topic.title = subject
|
||||||
|
topic.messages.forEach(m => m.subject = subject)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|
@ -184,7 +202,11 @@ export default createStore({
|
||||||
|
|
||||||
getters: {
|
getters: {
|
||||||
rules: state => state.rules,
|
rules: state => state.rules,
|
||||||
sortedTopics: state => [...state.topics].sort((a, b) => a.title.localeCompare(b.title))
|
sortedTopics: state => (
|
||||||
|
[...state.topics]
|
||||||
|
.sort((a, b) => a.title.localeCompare(b.title))
|
||||||
|
.filter(t => t.messages.length > 0)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue