diff options
author | Anthony Wang | 2023-02-15 16:22:43 -0500 |
---|---|---|
committer | Anthony Wang | 2023-02-15 16:22:43 -0500 |
commit | 091ff04c2420c8549ff581399212b4e3346864ee (patch) | |
tree | 746ad8767db3f3eab288eab4f08b74c37742777e /components/moderation.js | |
parent | fb3c976380e704a1c129f141f0bdb7f5f4576611 (diff) |
Delete all files except for demo
Diffstat (limited to 'components/moderation.js')
-rw-r--r-- | components/moderation.js | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/components/moderation.js b/components/moderation.js new file mode 100644 index 0000000..5e12fb0 --- /dev/null +++ b/components/moderation.js @@ -0,0 +1,63 @@ +import Chat from './chat.js' +import LikeButton from './like-button.js' +import { Name } from './name.js' + +export default { + + data: ()=> ({ + likeThreshold: 0, + channel: 'demo', + admin: null + }), + + methods: { + messageObjects: Chat.methods.messageObjects, + likeObjects: LikeButton.methods.likeObjects, + }, + + template: ` + <p> + Chat Channel: <input v-model="channel"/> + </p> + + <graffiti-objects :tags="[channel]" v-slot="{objects}"> + + <h3>Example 1</h3> + + <p> + Only show me objects with more than <input v-model.number="likeThreshold"/> likes. + </p> + + <ul v-for="object in messageObjects(objects)"> + <graffiti-objects :tags="[object._id]" v-slot="{objects: responses}"> + <li v-if="likeObjects(responses, object._id).length >= likeThreshold"> + <em><Name :of="object._by"/></em>: + {{ object.message }} + </li> + </graffiti-objects> + </ul> + + <h3>Example 2</h3> + + <p> + Only show me objects that + <select v-model="admin"> + <option v-for="id in objects.authors" :value="id"> + <Name :of="id"> + </option> + </select> + has liked. + </p> + + <ul v-for="object in messageObjects(objects)"> + <graffiti-objects :tags="[object._id]" v-slot="{objects: responses}"> + <li v-if="likeObjects(responses, object._id).filter(o=> o._by==admin).length"> + <em><Name :of="object._by"/></em>: + {{ object.message }} + </li> + </graffiti-objects> + </ul> + + </graffiti-objects>` +} + |