From df81365773b1b452a83a935add95be95a326fb62 Mon Sep 17 00:00:00 2001 From: harshbaz <106158714+harshbaz@users.noreply.github.com> Date: Tue, 5 Dec 2023 18:03:15 +0530 Subject: [PATCH] Add export (#2037) * Remove requiremant * Add json-2-csv * Add export dev route --- package-lock.json | 49 +++ packages/experiments/package.json | 1 + .../(feed)/up-down/results/ResultCard.svelte | 1 - .../experiments/src/routes/dev/+page.svelte | 352 +---------------- .../src/routes/dev/config/+page.svelte | 373 ++++++++++++++++++ .../src/routes/dev/export/+page.svelte | 166 ++++++++ 6 files changed, 594 insertions(+), 348 deletions(-) create mode 100644 packages/experiments/src/routes/dev/config/+page.svelte create mode 100644 packages/experiments/src/routes/dev/export/+page.svelte diff --git a/package-lock.json b/package-lock.json index 06ea10edb..f58bbfda3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4830,6 +4830,14 @@ "dev": true, "license": "MIT" }, + "node_modules/deeks": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/deeks/-/deeks-3.0.2.tgz", + "integrity": "sha512-c6OmjIygIB/avwXwEQOiODS+nw6fEX4cvOdDMqdL7dt3dicV/xykAJ9AeVc/8/JTVQDuacjRc9KCMmXafL1Y4A==", + "engines": { + "node": ">= 16" + } + }, "node_modules/deep-eql": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", @@ -4958,6 +4966,14 @@ "dev": true, "license": "MIT" }, + "node_modules/doc-path": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/doc-path/-/doc-path-4.0.2.tgz", + "integrity": "sha512-OqZEk7EM1aP3JpO+mq0pv1msEJWrzZVXu4q3YjEYJKc+Wt3/chac4KJdaGueK5IGemOwfptrLctG9I8xkb59qQ==", + "engines": { + "node": ">=16" + } + }, "node_modules/doctrine": { "version": "3.0.0", "dev": true, @@ -7245,6 +7261,18 @@ "node": ">=4" } }, + "node_modules/json-2-csv": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-2-csv/-/json-2-csv-5.0.1.tgz", + "integrity": "sha512-rP9ChyMskS0angbvFdQ43SwEe72mEvqcY1/V2OeukQWxtlreUuZWhMlTdWjtd4L6kJxq+HPFTI06yqLvZiEVIA==", + "dependencies": { + "deeks": "3.0.2", + "doc-path": "4.0.2" + }, + "engines": { + "node": ">= 16" + } + }, "node_modules/json-bigint": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz", @@ -12138,6 +12166,7 @@ "google-auth-library": "9.2.0", "hls.js": "^1.4.12", "idb": "^7.1.1", + "json-2-csv": "5.0.1", "svelte-local-storage-store": "^0.6.4", "throttle-debounce": "^5.0.0" }, @@ -13635,6 +13664,7 @@ "google-auth-library": "9.2.0", "hls.js": "^1.4.12", "idb": "^7.1.1", + "json-2-csv": "5.0.1", "postcss": "^8.4.31", "svelte": "^3.59.2", "svelte-check": "^3.6.2", @@ -15878,6 +15908,11 @@ "version": "10.4.3", "dev": true }, + "deeks": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/deeks/-/deeks-3.0.2.tgz", + "integrity": "sha512-c6OmjIygIB/avwXwEQOiODS+nw6fEX4cvOdDMqdL7dt3dicV/xykAJ9AeVc/8/JTVQDuacjRc9KCMmXafL1Y4A==" + }, "deep-eql": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", @@ -15972,6 +16007,11 @@ "version": "1.1.3", "dev": true }, + "doc-path": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/doc-path/-/doc-path-4.0.2.tgz", + "integrity": "sha512-OqZEk7EM1aP3JpO+mq0pv1msEJWrzZVXu4q3YjEYJKc+Wt3/chac4KJdaGueK5IGemOwfptrLctG9I8xkb59qQ==" + }, "doctrine": { "version": "3.0.0", "dev": true, @@ -17567,6 +17607,15 @@ "optional": true, "peer": true }, + "json-2-csv": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-2-csv/-/json-2-csv-5.0.1.tgz", + "integrity": "sha512-rP9ChyMskS0angbvFdQ43SwEe72mEvqcY1/V2OeukQWxtlreUuZWhMlTdWjtd4L6kJxq+HPFTI06yqLvZiEVIA==", + "requires": { + "deeks": "3.0.2", + "doc-path": "4.0.2" + } + }, "json-bigint": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz", diff --git a/packages/experiments/package.json b/packages/experiments/package.json index 4d2d2ae3c..0d0eeba4c 100644 --- a/packages/experiments/package.json +++ b/packages/experiments/package.json @@ -20,6 +20,7 @@ "google-auth-library": "9.2.0", "hls.js": "^1.4.12", "idb": "^7.1.1", + "json-2-csv": "5.0.1", "firebase": "10.6.0", "svelte-local-storage-store": "^0.6.4", "throttle-debounce": "^5.0.0" diff --git a/packages/experiments/src/routes/(feed)/up-down/results/ResultCard.svelte b/packages/experiments/src/routes/(feed)/up-down/results/ResultCard.svelte index c9fd8f2ce..9cf1fc4d7 100644 --- a/packages/experiments/src/routes/(feed)/up-down/results/ResultCard.svelte +++ b/packages/experiments/src/routes/(feed)/up-down/results/ResultCard.svelte @@ -2,7 +2,6 @@ import Avatar from '$components/avatar/Avatar.svelte' import Icon from '$components/icon/Icon.svelte' import type { VoteRecordWithId } from '$components/up-down/UpDownVote.svelte' -import type { VoteRecord } from '$lib/db/db.types' import { getThumbnailUrl } from '$lib/utils/cloudflare' import { getMsLeftForResult, getVoteEndTime } from '$lib/utils/countdown' import { pluralize } from '$lib/utils/pluralize' diff --git a/packages/experiments/src/routes/dev/+page.svelte b/packages/experiments/src/routes/dev/+page.svelte index 4635a6b7a..bdedef593 100644 --- a/packages/experiments/src/routes/dev/+page.svelte +++ b/packages/experiments/src/routes/dev/+page.svelte @@ -1,86 +1,17 @@ + +{#if !allowed} +
{key} : {JSON.stringify(
+ currentParams[key],
+ null,
+ 4,
+ )}
+ {/each}
+ {:else}
+