diff options
author | jdlugosz963 <jdlugosz963@gmail.com> | 2021-12-13 15:21:21 +0100 |
---|---|---|
committer | jdlugosz963 <jdlugosz963@gmail.com> | 2021-12-13 15:21:21 +0100 |
commit | 98bec5686da0c4b7d0279b94968040b01e3218fa (patch) | |
tree | 1489bbc80965457ba77c06da57ec496802b03c3d /src | |
parent | 4b6be9f09ff56dfae1c719cb744f2312e11be317 (diff) | |
download | lom_frontend-98bec5686da0c4b7d0279b94968040b01e3218fa.tar.gz lom_frontend-98bec5686da0c4b7d0279b94968040b01e3218fa.zip |
add group searcher dont work for now
Diffstat (limited to 'src')
-rw-r--r-- | src/components/GroupMaker.vue | 22 | ||||
-rw-r--r-- | src/components/GroupView.vue | 47 | ||||
-rw-r--r-- | src/components/Searcher.vue | 13 | ||||
-rw-r--r-- | src/services/ChatService.js | 12 | ||||
-rw-r--r-- | src/services/CommandsService.js | 14 | ||||
-rw-r--r-- | src/views/Home.vue | 2 |
6 files changed, 100 insertions, 10 deletions
diff --git a/src/components/GroupMaker.vue b/src/components/GroupMaker.vue index 59f83fd..f3da293 100644 --- a/src/components/GroupMaker.vue +++ b/src/components/GroupMaker.vue | |||
@@ -49,11 +49,15 @@ export default { | |||
49 | "users": this.users_selection | 49 | "users": this.users_selection |
50 | }) | 50 | }) |
51 | 51 | ||
52 | if(status === 201) | 52 | if(status === 201) { |
53 | this.$notify({ | 53 | this.$notify({ |
54 | type: "success", | 54 | type: "success", |
55 | text: "Group created!" | 55 | text: "Group created!" |
56 | }) | 56 | }) |
57 | |||
58 | this.close() | ||
59 | } | ||
60 | |||
57 | }, | 61 | }, |
58 | 62 | ||
59 | async set_users() { | 63 | async set_users() { |
@@ -77,3 +81,19 @@ export default { | |||
77 | } | 81 | } |
78 | } | 82 | } |
79 | </script> | 83 | </script> |
84 | |||
85 | <style scoped> | ||
86 | |||
87 | .group_maker { | ||
88 | position: absolute; | ||
89 | width: 30%; | ||
90 | height: 80%; | ||
91 | top: 50%; | ||
92 | left: 50%; | ||
93 | background-color: #202020; | ||
94 | padding: 20px; | ||
95 | border-radius: 10px; | ||
96 | transform: translate(-50%, -50%); | ||
97 | } | ||
98 | |||
99 | </style> | ||
diff --git a/src/components/GroupView.vue b/src/components/GroupView.vue new file mode 100644 index 0000000..1608cf4 --- /dev/null +++ b/src/components/GroupView.vue | |||
@@ -0,0 +1,47 @@ | |||
1 | <template> | ||
2 | <div class="group_view"> | ||
3 | Group maker | ||
4 | <form @submit="send_message"> | ||
5 | <inout type="text" ref="input" /> | ||
6 | </form> | ||
7 | </div> | ||
8 | </template> | ||
9 | |||
10 | <script> | ||
11 | import ChatService from "@/services/ChatService.js" | ||
12 | |||
13 | export default { | ||
14 | data() { | ||
15 | return { | ||
16 | } | ||
17 | }, | ||
18 | |||
19 | methods: { | ||
20 | close() { | ||
21 | this.$emit('close') | ||
22 | }, | ||
23 | }, | ||
24 | |||
25 | created() { | ||
26 | this.$nextTick(function () { | ||
27 | this.$refs.input.focus() | ||
28 | }) | ||
29 | } | ||
30 | } | ||
31 | </script> | ||
32 | |||
33 | <style scoped> | ||
34 | |||
35 | .group_view { | ||
36 | position: absolute; | ||
37 | width: 30%; | ||
38 | height: 80%; | ||
39 | top: 50%; | ||
40 | left: 50%; | ||
41 | background-color: #202020; | ||
42 | padding: 20px; | ||
43 | border-radius: 10px; | ||
44 | transform: translate(-50%, -50%); | ||
45 | } | ||
46 | |||
47 | </style> | ||
diff --git a/src/components/Searcher.vue b/src/components/Searcher.vue index 8488fd4..a1093a2 100644 --- a/src/components/Searcher.vue +++ b/src/components/Searcher.vue | |||
@@ -61,9 +61,10 @@ export default { | |||
61 | else this.current = this.sugestions[0] | 61 | else this.current = this.sugestions[0] |
62 | }, | 62 | }, |
63 | 63 | ||
64 | execute_current() { | 64 | async execute_current() { |
65 | let out = this.current[1](this) | 65 | let out = await this.current[1](this) |
66 | 66 | ||
67 | console.log(out) | ||
67 | if(out instanceof Object) { | 68 | if(out instanceof Object) { |
68 | this.search = '' | 69 | this.search = '' |
69 | this.commands = out | 70 | this.commands = out |
@@ -71,25 +72,23 @@ export default { | |||
71 | }, | 72 | }, |
72 | 73 | ||
73 | hotkeys(e) { | 74 | hotkeys(e) { |
75 | e.preventDefault() | ||
76 | |||
74 | switch(e.code) { | 77 | switch(e.code) { |
75 | case 'Escape': | 78 | case 'Escape': |
76 | this.close() | 79 | this.close() |
77 | break | 80 | break |
78 | case 'ArrowDown': | 81 | case 'ArrowDown': |
79 | e.preventDefault() | ||
80 | this.change_current(1) | 82 | this.change_current(1) |
81 | break | 83 | break |
82 | case 'ArrowUp': | 84 | case 'ArrowUp': |
83 | e.preventDefault() | ||
84 | this.change_current(-1) | 85 | this.change_current(-1) |
85 | break | 86 | break |
86 | case 'Tab': | 87 | case 'Tab': |
87 | e.preventDefault() | ||
88 | this.change_current(1) | 88 | this.change_current(1) |
89 | break | 89 | break |
90 | case 'Enter': | 90 | case 'Enter': |
91 | this.execute_current() | 91 | this.execute_current() |
92 | e.preventDefault() | ||
93 | break | 92 | break |
94 | case 'ShiftLeft': | 93 | case 'ShiftLeft': |
95 | this.commands = CommandsService | 94 | this.commands = CommandsService |
diff --git a/src/services/ChatService.js b/src/services/ChatService.js index ab1e6c2..08deba2 100644 --- a/src/services/ChatService.js +++ b/src/services/ChatService.js | |||
@@ -13,5 +13,17 @@ export default { | |||
13 | } | 13 | } |
14 | }) | 14 | }) |
15 | .catch(error => error_notify(error)) | 15 | .catch(error => error_notify(error)) |
16 | }, | ||
17 | |||
18 | async get_all_user_groups() { | ||
19 | return await axios | ||
20 | .get(url+'groups/') | ||
21 | .then(res => { | ||
22 | return { | ||
23 | status: res.status, | ||
24 | data: res.data | ||
25 | } | ||
26 | }) | ||
27 | .catch(error => error_notify(error)) | ||
16 | } | 28 | } |
17 | } | 29 | } |
diff --git a/src/services/CommandsService.js b/src/services/CommandsService.js index 01a758e..e21c8f7 100644 --- a/src/services/CommandsService.js +++ b/src/services/CommandsService.js | |||
@@ -1,11 +1,23 @@ | |||
1 | import AuthService from "./AuthService" | 1 | import AuthService from "./AuthService" |
2 | import ChatService from "./ChatService" | ||
2 | import store from "@/store/index.js" | 3 | import store from "@/store/index.js" |
3 | import router from '@/router/index.js' | 4 | import router from '@/router/index.js' |
4 | 5 | ||
6 | function set_groups(data) { | ||
7 | return {[data.name.replace(" ", "_")]() {console.log(data.name)}} | ||
8 | } | ||
9 | |||
5 | export default { | 10 | export default { |
6 | groups() { | 11 | groups() { |
7 | return { | 12 | return { |
8 | send(searcher) {console.log(searcher)}, | 13 | async send() { |
14 | const {data, status} = await ChatService.get_all_user_groups() | ||
15 | if (status!==200) | ||
16 | return {} | ||
17 | const test1 = set_groups(data[0]) | ||
18 | const test2 = set_groups(data[0]) | ||
19 | return {test1, test2} | ||
20 | }, | ||
9 | 21 | ||
10 | make(searcher) { | 22 | make(searcher) { |
11 | searcher.$emit('toogle_group_maker') | 23 | searcher.$emit('toogle_group_maker') |
diff --git a/src/views/Home.vue b/src/views/Home.vue index abf6fc8..5355520 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue | |||
@@ -38,7 +38,7 @@ export default { | |||
38 | }, | 38 | }, |
39 | 39 | ||
40 | toogleSearcherShow() { this.popups.searcher_show = !this.popups.searcher_show }, | 40 | toogleSearcherShow() { this.popups.searcher_show = !this.popups.searcher_show }, |
41 | hideSearcher() { this.popups.searcher_show = false }, | 41 | hideSearcher() { this.popups.searcher_show = true }, |
42 | 42 | ||
43 | toogleGroupShow() { this.popups.group_maker_show = !this.popups.group_maker_show }, | 43 | toogleGroupShow() { this.popups.group_maker_show = !this.popups.group_maker_show }, |
44 | hideGroup() { this.popups.group_maker_show = false } | 44 | hideGroup() { this.popups.group_maker_show = false } |