Skip to content

Commit 63dcc0f

Browse files
authored
Merge pull request #8 from yoshixmk/develop
Develop
2 parents 1a09cba + 829e80c commit 63dcc0f

File tree

7 files changed

+523
-622
lines changed

7 files changed

+523
-622
lines changed

.node-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
14.15.0
1+
14.15.3

package.json

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "f3",
3-
"version": "0.0.4",
3+
"version": "0.1.0",
44
"private": false,
55
"description": "Facilitating conversations using Fist to Five.",
66
"author": "yoshixmk",
@@ -23,41 +23,41 @@
2323
"start:server": "node dist/server/index.js"
2424
},
2525
"dependencies": {
26-
"apexcharts": "3.22.1",
27-
"axios": "0.21.0",
28-
"bootstrap": "5.0.0-alpha2",
26+
"@popperjs/core": "2.6.0",
27+
"apexcharts": "3.23.0",
28+
"axios": "0.21.1",
29+
"bootstrap": "5.0.0-beta1",
2930
"cors": "2.8.5",
30-
"popper.js": "1.16.1",
31-
"vue": "3.0.2",
32-
"vuex": "4.0.0-rc.1"
31+
"vue": "3.0.4",
32+
"vue3-apexcharts": "1.1.1",
33+
"vuex": "4.0.0-rc.2"
3334
},
3435
"devDependencies": {
35-
"@types/cors": "2.8.8",
36-
"@types/node": "14.14.6",
37-
"@typescript-eslint/eslint-plugin": "4.6.1",
38-
"@typescript-eslint/parser": "4.6.1",
39-
"@vue/compiler-sfc": "3.0.2",
36+
"@types/cors": "2.8.9",
37+
"@types/node": "14.14.16",
38+
"@typescript-eslint/eslint-plugin": "4.11.0",
39+
"@typescript-eslint/parser": "4.11.0",
4040
"concurrently": "5.3.0",
4141
"dotenv": "8.2.0",
42-
"eslint": "7.12.1",
43-
"eslint-plugin-vue": "7.1.0",
42+
"eslint": "7.16.0",
43+
"eslint-plugin-vue": "7.3.0",
4444
"express": "4.17.1",
4545
"rimraf": "3.0.2",
4646
"rome": "10.0.4-beta",
47-
"sass": "1.28.0",
48-
"ts-node": "9.0.0",
49-
"ts-node-dev": "1.0.0",
50-
"typescript": "4.0.5",
51-
"vite": "1.0.0-rc.9",
52-
"vue-eslint-parser": "7.1.1"
47+
"sass": "1.30.0",
48+
"ts-node": "9.1.1",
49+
"ts-node-dev": "1.1.1",
50+
"typescript": "4.1.3",
51+
"vite": "1.0.0-rc.13",
52+
"vue-eslint-parser": "7.3.0"
5353
},
5454
"license": "MIT",
5555
"repository": {
5656
"type": "git",
5757
"url": "https://github.com/yoshixmk/f3"
5858
},
5959
"engines": {
60-
"node": ">= 14.13.0",
60+
"node": ">= 14.15.0",
6161
"npm": "npm is not supported"
6262
},
6363
"engineStrict": true

src/components/molecules/ResetButton.vue

Lines changed: 0 additions & 35 deletions
This file was deleted.

src/components/molecules/ResultBarChart.vue

Lines changed: 0 additions & 108 deletions
This file was deleted.
Lines changed: 66 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,88 @@
11
<template>
22
<user-info :fingers="fingers" />
3-
<result-bar-chart
4-
:fingers="fingers"
3+
<apexchart
4+
height="350"
5+
type="bar"
6+
:options="options"
7+
:series="series"
8+
:tooltip="tooltip"
59
/>
6-
<br>
7-
<reset-button />
810
</template>
911

1012
<script lang="ts">
1113
import UserInfo from "./UserInfo.vue";
12-
import ResultBarChart from "../molecules/ResultBarChart.vue";
13-
import ResetButton from "../molecules/ResetButton.vue";
1414
import { Fingers } from "../../domains/fingers";
1515
import { defineComponent, PropType } from "vue";
1616
17+
type GroupedByUsers = {
18+
[key: number]: Fingers | undefined;
19+
};
20+
1721
export default defineComponent({
1822
components: {
1923
UserInfo,
20-
ResetButton,
21-
ResultBarChart,
2224
},
2325
props: {
2426
fingers: {
2527
type: Object as PropType<Fingers>,
2628
default: [],
2729
},
2830
},
31+
data() {
32+
return {
33+
options: {
34+
chart: {
35+
id: 'f3-chart'
36+
},
37+
xaxis: {
38+
categories: [1, 2, 3, 4, 5]
39+
}
40+
},
41+
}
42+
},
43+
computed: {
44+
series() {
45+
const data: GroupedByUsers = this.getUsersGroupBy();
46+
return [
47+
{
48+
name: "vote",
49+
data: [
50+
// Number of people
51+
data[1]?.length ?? 0,
52+
data[2]?.length ?? 0,
53+
data[3]?.length ?? 0,
54+
data[4]?.length ?? 0,
55+
data[5]?.length ?? 0,
56+
],
57+
},
58+
]
59+
},
60+
tooltip() {
61+
const data: GroupedByUsers = this.getUsersGroupBy();
62+
return {
63+
custom: function ({ dataPointIndex }: { dataPointIndex: number }) {
64+
const index = dataPointIndex ?? 0;
65+
return (
66+
'<div class="arrow_box p-1">' +
67+
"<span>" +
68+
data[index + 1]?.map((d) => d.name)?.join("<br>") ??
69+
"" + "</span>" + "</div>"
70+
);
71+
}
72+
}
73+
},
74+
},
75+
methods: {
76+
getUsersGroupBy(): GroupedByUsers {
77+
const result = this.fingers?.reduce(
78+
(h, obj) =>
79+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
80+
Object.assign(h, { [obj.value]: ((h as any)[obj.value] || []).concat(obj) }),
81+
{}
82+
);
83+
console.log(result);
84+
return result;
85+
},
86+
}
2987
});
3088
</script>

src/main.mjs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ import store from "./store";
33

44
import VoteApp from "./VoteApp.vue";
55
import FacilitatorApp from "./FacilitatorApp.vue";
6-
import "popper.js";
6+
import "@popperjs/core";
77
import "bootstrap";
88
import "bootstrap/dist/css/bootstrap.min.css";
99
import { axiosPlugin } from "./plugins/useAxios";
10+
import VueApexCharts from "vue3-apexcharts";
1011

1112
const NotFoundComponent = { template: "<p>Page not found</p>" };
1213

@@ -31,4 +32,8 @@ export const router = {
3132
},
3233
};
3334

34-
createApp(router).use(store).use(axiosPlugin).mount("#app");
35+
createApp(router)
36+
.use(store)
37+
.use(axiosPlugin)
38+
.use(VueApexCharts)
39+
.mount("#app");

0 commit comments

Comments
 (0)