From 26928ab407902a52ddd3e801708007683b41a648 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 24 Oct 2021 12:32:41 +0900 Subject: [PATCH] Remove apexcharts Resolve #7907 --- package.json | 7 +- src/client/components/chart.vue | 41 ++++++++- src/client/pages/settings/drive.vue | 101 +---------------------- src/client/pages/user/index.activity.vue | 96 +-------------------- yarn.lock | 67 --------------- 5 files changed, 47 insertions(+), 265 deletions(-) diff --git a/package.json b/package.json index 9e1fdd482..b290cf3b0 100644 --- a/package.json +++ b/package.json @@ -60,9 +60,6 @@ "@types/jsonld": "1.5.6", "@types/katex": "0.11.1", "@types/koa": "2.13.4", - "@types/koa__cors": "3.0.3", - "@types/koa__multer": "2.0.3", - "@types/koa__router": "8.0.8", "@types/koa-bodyparser": "4.3.3", "@types/koa-cors": "0.0.2", "@types/koa-favicon": "2.0.21", @@ -70,6 +67,9 @@ "@types/koa-mount": "4.0.1", "@types/koa-send": "4.1.3", "@types/koa-views": "7.0.0", + "@types/koa__cors": "3.0.3", + "@types/koa__multer": "2.0.3", + "@types/koa__router": "8.0.8", "@types/markdown-it": "12.2.3", "@types/matter-js": "0.17.5", "@types/mocha": "8.2.3", @@ -106,7 +106,6 @@ "@typescript-eslint/parser": "5.0.0", "@vue/compiler-sfc": "3.2.20", "abort-controller": "3.0.0", - "apexcharts": "3.28.3", "autobind-decorator": "2.4.0", "autosize": "4.0.4", "autwh": "0.1.0", diff --git a/src/client/components/chart.vue b/src/client/components/chart.vue index 2b94bd679..ae9a5e79b 100644 --- a/src/client/components/chart.vue +++ b/src/client/components/chart.vue @@ -89,6 +89,16 @@ export default defineComponent({ required: false, default: false }, + stacked: { + type: Boolean, + required: false, + default: false + }, + aspectRatio: { + type: Number, + required: false, + default: null + }, }, setup(props) { @@ -157,7 +167,7 @@ export default defineComponent({ })), }, options: { - aspectRatio: 2.5, + aspectRatio: props.aspectRatio || 2.5, layout: { padding: { left: 16, @@ -174,7 +184,6 @@ export default defineComponent({ unit: props.span === 'day' ? 'month' : 'day', }, grid: { - display: props.detailed, color: gridColor, borderColor: 'rgb(0, 0, 0, 0)', }, @@ -190,6 +199,7 @@ export default defineComponent({ }, y: { position: 'left', + stacked: props.stacked, grid: { color: gridColor, borderColor: 'rgb(0, 0, 0, 0)', @@ -204,6 +214,7 @@ export default defineComponent({ }, plugins: { legend: { + display: props.detailed, position: 'bottom', labels: { boxWidth: 16, @@ -583,6 +594,30 @@ export default defineComponent({ }; }; + const fetchPerUserNotesChart = async (): Promise => { + const raw = await os.api('charts/user/notes', { userId: props.args.user.id, limit: props.limit, span: props.span }); + return { + series: [...(props.args.withoutAll ? [] : [{ + name: 'All', + type: 'line', + borderDash: [5, 5], + data: format(sum(raw.inc, negate(raw.dec))), + }]), { + name: 'Renotes', + type: 'area', + data: format(raw.diffs.renote), + }, { + name: 'Replies', + type: 'area', + data: format(raw.diffs.reply), + }, { + name: 'Normal', + type: 'area', + data: format(raw.diffs.normal), + }], + }; + }; + const fetchAndRender = async () => { const fetchData = () => { switch (props.src) { @@ -611,6 +646,8 @@ export default defineComponent({ case 'instance-drive-usage-total': return fetchInstanceDriveUsageChart(true); case 'instance-drive-files': return fetchInstanceDriveFilesChart(false); case 'instance-drive-files-total': return fetchInstanceDriveFilesChart(true); + + case 'per-user-notes': return fetchPerUserNotesChart(); } }; fetching.value = true; diff --git a/src/client/pages/settings/drive.vue b/src/client/pages/settings/drive.vue index 177bf058f..2d73eb4df 100644 --- a/src/client/pages/settings/drive.vue +++ b/src/client/pages/settings/drive.vue @@ -35,7 +35,6 @@ diff --git a/yarn.lock b/yarn.lock index 449390a6a..b096bfc91 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1809,18 +1809,6 @@ anymatch@~3.1.1: normalize-path "^3.0.0" picomatch "^2.0.4" -apexcharts@3.28.3: - version "3.28.3" - resolved "https://registry.yarnpkg.com/apexcharts/-/apexcharts-3.28.3.tgz#22a6d9b234c82f6c2e1dd4aebba05b7603e2b1d2" - integrity sha512-EhghB2P27/Gjhwct8sSS0V63mdpRMx/ikH34dwUTqZQnkAEyOS/RKDmYjXBNA7zsAKBE/pThOdoTya6ADyk6zQ== - dependencies: - svg.draggable.js "^2.2.2" - svg.easing.js "^2.0.0" - svg.filter.js "^2.0.2" - svg.pathmorphing.js "^0.1.3" - svg.resize.js "^1.4.3" - svg.select.js "^3.0.1" - app-root-path@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/app-root-path/-/app-root-path-3.0.0.tgz#210b6f43873227e18a4b810a032283311555d5ad" @@ -10529,61 +10517,6 @@ sver-compat@^1.5.0: es6-iterator "^2.0.1" es6-symbol "^3.1.1" -svg.draggable.js@^2.2.2: - version "2.2.2" - resolved "https://registry.yarnpkg.com/svg.draggable.js/-/svg.draggable.js-2.2.2.tgz#c514a2f1405efb6f0263e7958f5b68fce50603ba" - integrity sha512-JzNHBc2fLQMzYCZ90KZHN2ohXL0BQJGQimK1kGk6AvSeibuKcIdDX9Kr0dT9+UJ5O8nYA0RB839Lhvk4CY4MZw== - dependencies: - svg.js "^2.0.1" - -svg.easing.js@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/svg.easing.js/-/svg.easing.js-2.0.0.tgz#8aa9946b0a8e27857a5c40a10eba4091e5691f12" - integrity sha1-iqmUawqOJ4V6XEChDrpAkeVpHxI= - dependencies: - svg.js ">=2.3.x" - -svg.filter.js@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/svg.filter.js/-/svg.filter.js-2.0.2.tgz#91008e151389dd9230779fcbe6e2c9a362d1c203" - integrity sha1-kQCOFROJ3ZIwd5/L5uLJo2LRwgM= - dependencies: - svg.js "^2.2.5" - -svg.js@>=2.3.x, svg.js@^2.0.1, svg.js@^2.2.5, svg.js@^2.4.0, svg.js@^2.6.5: - version "2.7.1" - resolved "https://registry.yarnpkg.com/svg.js/-/svg.js-2.7.1.tgz#eb977ed4737001eab859949b4a398ee1bb79948d" - integrity sha512-ycbxpizEQktk3FYvn/8BH+6/EuWXg7ZpQREJvgacqn46gIddG24tNNe4Son6omdXCnSOaApnpZw6MPCBA1dODA== - -svg.pathmorphing.js@^0.1.3: - version "0.1.3" - resolved "https://registry.yarnpkg.com/svg.pathmorphing.js/-/svg.pathmorphing.js-0.1.3.tgz#c25718a1cc7c36e852ecabc380e758ac09bb2b65" - integrity sha512-49HWI9X4XQR/JG1qXkSDV8xViuTLIWm/B/7YuQELV5KMOPtXjiwH4XPJvr/ghEDibmLQ9Oc22dpWpG0vUDDNww== - dependencies: - svg.js "^2.4.0" - -svg.resize.js@^1.4.3: - version "1.4.3" - resolved "https://registry.yarnpkg.com/svg.resize.js/-/svg.resize.js-1.4.3.tgz#885abd248e0cd205b36b973c4b578b9a36f23332" - integrity sha512-9k5sXJuPKp+mVzXNvxz7U0uC9oVMQrrf7cFsETznzUDDm0x8+77dtZkWdMfRlmbkEEYvUn9btKuZ3n41oNA+uw== - dependencies: - svg.js "^2.6.5" - svg.select.js "^2.1.2" - -svg.select.js@^2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/svg.select.js/-/svg.select.js-2.1.2.tgz#e41ce13b1acff43a7441f9f8be87a2319c87be73" - integrity sha512-tH6ABEyJsAOVAhwcCjF8mw4crjXSI1aa7j2VQR8ZuJ37H2MBUbyeqYr5nEO7sSN3cy9AR9DUwNg0t/962HlDbQ== - dependencies: - svg.js "^2.2.5" - -svg.select.js@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/svg.select.js/-/svg.select.js-3.0.1.tgz#a4198e359f3825739226415f82176a90ea5cc917" - integrity sha512-h5IS/hKkuVCbKSieR9uQCj9w+zLHoPh+ce19bBYyqF53g6mnPB8sAtIbe1s9dh2S2fCmYX2xel1Ln3PJBbK4kw== - dependencies: - svg.js "^2.6.5" - svgo@^0.7.0: version "0.7.2" resolved "https://registry.yarnpkg.com/svgo/-/svgo-0.7.2.tgz#9f5772413952135c6fefbf40afe6a4faa88b4bb5"