From 974738cb241b216ad864f129ca2388379c5f0016 Mon Sep 17 00:00:00 2001 From: theia Date: Fri, 3 Feb 2023 13:09:02 -0500 Subject: Demo to root --- demo/components/chat.js | 60 ++++++++++++++++++++++++++ demo/components/name.js | 56 +++++++++++++++++++++++++ demo/index.html | 84 +++++++++++++++++++++++++++++++++++++ index.html | 84 ------------------------------------- plugins/vue/demo/components/chat.js | 60 -------------------------- plugins/vue/demo/components/name.js | 56 ------------------------- plugins/vue/demo/index.html | 84 ------------------------------------- 7 files changed, 200 insertions(+), 284 deletions(-) create mode 100644 demo/components/chat.js create mode 100644 demo/components/name.js create mode 100644 demo/index.html delete mode 100644 index.html delete mode 100644 plugins/vue/demo/components/chat.js delete mode 100644 plugins/vue/demo/components/name.js delete mode 100644 plugins/vue/demo/index.html diff --git a/demo/components/chat.js b/demo/components/chat.js new file mode 100644 index 0000000..86d8fe7 --- /dev/null +++ b/demo/components/chat.js @@ -0,0 +1,60 @@ +import { Name } from './name.js' + +export default { + + components: { Name }, + + props: ['tags'], + + data: ()=> ({ + message: '' + }), + + methods: { + messageObjects(objects) { + return objects.filter(o=> + 'message' in o && + 'timestamp' in o && + typeof o.message == 'string' && + typeof o.timestamp == 'number') + .sortBy('timestamp') + }, + + sendMessage() { + if (!this.message) return + this.$graffitiUpdate({ + message: this.message, + timestamp: Date.now(), + _tags: this.tags + }) + this.message = '' + } + }, + + template: ` + + + + +
+ + +
` +} + diff --git a/demo/components/name.js b/demo/components/name.js new file mode 100644 index 0000000..ea44f95 --- /dev/null +++ b/demo/components/name.js @@ -0,0 +1,56 @@ +export const Name = { + + props: ["of"], + + methods: { + name(objects) { + const nameObjects = objects + .filter(o=> + 'name' in o && + 'of' in o && + 'timestamp' in o && + typeof o.name == 'string' && + o.of == this.of && + o._by == this.of && + typeof o.timestamp == 'number') + .sortBy('-timestamp') + + return nameObjects.length? + nameObjects[0].name : 'anonymous' + } + }, + + template: ` + + {{ name(objects) }} + ` +} + +export const SetMyName = { + + props: ["tags"], + + data: ()=> ({ + name: '' + }), + + methods: { + setMyName() { + this.$graffitiUpdate({ + name: this.name, + timestamp: Date.now(), + of: this.$graffitiMyID, + _tags: this.tags + }) + this.name = '' + } + }, + + template: ` +
+ + +
+ +
` +} diff --git a/demo/index.html b/demo/index.html new file mode 100644 index 0000000..7a142c1 --- /dev/null +++ b/demo/index.html @@ -0,0 +1,84 @@ + + + + + Graffiti Vue + + + + + + + + + +

+ Connection Status +

+ +

+ Connected to the Graffiti server? {{ $graffitiConnected }} +

+ +

+ Logging In +

+ +

+ +

+ +

+ My Graffiti ID is "{{ $graffitiMyID }}" +

+ +
+ +

+ Profile +

+ +

+ My name is: +

+ + + +
+ +

+ Chatting +

+ + + + + + + + + + + + + + + + diff --git a/index.html b/index.html deleted file mode 100644 index e3c2dc0..0000000 --- a/index.html +++ /dev/null @@ -1,84 +0,0 @@ - - - -

Graffiti x JS

- -

- -

- - - - - - - - - - - - - - diff --git a/plugins/vue/demo/components/chat.js b/plugins/vue/demo/components/chat.js deleted file mode 100644 index 7453d77..0000000 --- a/plugins/vue/demo/components/chat.js +++ /dev/null @@ -1,60 +0,0 @@ -import { Name } from './name.js' - -export default { - - components: { Name }, - - props: ['tags'], - - data: ()=> ({ - message: '' - }), - - methods: { - messageObjects(objects) { - return objects.filter(o=> - 'message' in o && - 'timestamp' in o && - typeof o.message == 'string' && - typeof o.timestamp == 'number') - .sortBy('timestamp') - }, - - sendMessage() { - if (!this.message) return - this.$graffitiUpdate({ - message: this.message, - timestamp: Date.now(), - _tags: this.tags - }) - this.message = '' - } - }, - - template: ` - - - - -
- - -
` -} - diff --git a/plugins/vue/demo/components/name.js b/plugins/vue/demo/components/name.js deleted file mode 100644 index ea44f95..0000000 --- a/plugins/vue/demo/components/name.js +++ /dev/null @@ -1,56 +0,0 @@ -export const Name = { - - props: ["of"], - - methods: { - name(objects) { - const nameObjects = objects - .filter(o=> - 'name' in o && - 'of' in o && - 'timestamp' in o && - typeof o.name == 'string' && - o.of == this.of && - o._by == this.of && - typeof o.timestamp == 'number') - .sortBy('-timestamp') - - return nameObjects.length? - nameObjects[0].name : 'anonymous' - } - }, - - template: ` - - {{ name(objects) }} - ` -} - -export const SetMyName = { - - props: ["tags"], - - data: ()=> ({ - name: '' - }), - - methods: { - setMyName() { - this.$graffitiUpdate({ - name: this.name, - timestamp: Date.now(), - of: this.$graffitiMyID, - _tags: this.tags - }) - this.name = '' - } - }, - - template: ` -
- - -
- -
` -} diff --git a/plugins/vue/demo/index.html b/plugins/vue/demo/index.html deleted file mode 100644 index 7a142c1..0000000 --- a/plugins/vue/demo/index.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - - Graffiti Vue - - - - - - - - - -

- Connection Status -

- -

- Connected to the Graffiti server? {{ $graffitiConnected }} -

- -

- Logging In -

- -

- -

- -

- My Graffiti ID is "{{ $graffitiMyID }}" -

- -
- -

- Profile -

- -

- My name is: -

- - - -
- -

- Chatting -

- - - - - - - - - - - - - - - - -- cgit v1.2.3-70-g09d2