From 3258f2023fffe171fba0caf25ab5e6c53d2064a3 Mon Sep 17 00:00:00 2001 From: Luc Date: Wed, 9 Aug 2023 12:58:35 +0000 Subject: [PATCH 1/5] Patch Discord username format --- e2e/specs/stateful/profile.spec.ts | 2 +- public/locales/en/register.json | 2 +- public/locales/en/transactionFlow.json | 2 +- public/locales/nl/transactionFlow.json | 2 +- public/locales/zh/register.json | 2 +- public/locales/zh/transactionFlow.json | 2 +- .../input/AdvancedEditor/AdvancedEditor.test.tsx | 2 +- src/transaction-flow/input/ProfileEditor/ProfileEditor.test.tsx | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/e2e/specs/stateful/profile.spec.ts b/e2e/specs/stateful/profile.spec.ts index ef401983a..4cacd8fee 100644 --- a/e2e/specs/stateful/profile.spec.ts +++ b/e2e/specs/stateful/profile.spec.ts @@ -29,7 +29,7 @@ const profiles = [ { type: 'account', key: 'com.discord', - value: 'ens#0700', + value: 'lucemans', }, { type: 'account', diff --git a/public/locales/en/register.json b/public/locales/en/register.json index 1f9de2574..8597d8579 100644 --- a/public/locales/en/register.json +++ b/public/locales/en/register.json @@ -67,7 +67,7 @@ "placeholder": { "com.twitter": "e.g. ensdomains", "com.github": "e.g. ensdomains", - "com.discord": "e.g. alisha.eth#0001", + "com.discord": "e.g. lucemans", "org.telegram": "e.g. futurealisha", "email": "e.g. hello@example.com" } diff --git a/public/locales/en/transactionFlow.json b/public/locales/en/transactionFlow.json index dc16be42e..57315b313 100644 --- a/public/locales/en/transactionFlow.json +++ b/public/locales/en/transactionFlow.json @@ -55,7 +55,7 @@ "default": "Add username here", "com.twitter": "e.g. ensdomains", "com.github": "e.g. ensdomains", - "com.discord": "e.g. alisha.eth#0001", + "com.discord": "e.g. lucemans", "org.telegram": "e.g. futurealisha", "email": "e.g. hello@example.com" } diff --git a/public/locales/nl/transactionFlow.json b/public/locales/nl/transactionFlow.json index 9a7b2fafa..334e10f81 100644 --- a/public/locales/nl/transactionFlow.json +++ b/public/locales/nl/transactionFlow.json @@ -54,7 +54,7 @@ "default": "Voeg username hier toe", "com.twitter": "e.g. ensdomains", "com.github": "e.g. ensdomains", - "com.discord": "e.g. alisha.eth#0001" + "com.discord": "e.g. lucemans" } }, "address": { diff --git a/public/locales/zh/register.json b/public/locales/zh/register.json index 80e9fb942..3be03b86b 100644 --- a/public/locales/zh/register.json +++ b/public/locales/zh/register.json @@ -65,7 +65,7 @@ "placeholder": { "com.twitter": "例如 ensdomains", "com.github": "例如 ensdomains", - "com.discord": "例如 alisha.eth#0001" + "com.discord": "例如 lucemans" } }, "address": { diff --git a/public/locales/zh/transactionFlow.json b/public/locales/zh/transactionFlow.json index dd58e61d0..a589801fc 100644 --- a/public/locales/zh/transactionFlow.json +++ b/public/locales/zh/transactionFlow.json @@ -55,7 +55,7 @@ "default": "在此添加用户名", "com.twitter": "例如 ensdomains", "com.github": "例如 ensdomains", - "com.discord": "例如 alisha.eth#0001" + "com.discord": "例如 lucemans" } }, "address": { diff --git a/src/transaction-flow/input/AdvancedEditor/AdvancedEditor.test.tsx b/src/transaction-flow/input/AdvancedEditor/AdvancedEditor.test.tsx index caddcb705..ebbf8df1c 100644 --- a/src/transaction-flow/input/AdvancedEditor/AdvancedEditor.test.tsx +++ b/src/transaction-flow/input/AdvancedEditor/AdvancedEditor.test.tsx @@ -41,7 +41,7 @@ const mockProfileData = { { key: 'com.discord', type: 'text', - value: 'test#1234', + value: 'test', }, { key: 'com.reddit', diff --git a/src/transaction-flow/input/ProfileEditor/ProfileEditor.test.tsx b/src/transaction-flow/input/ProfileEditor/ProfileEditor.test.tsx index 17a554806..43f63b558 100644 --- a/src/transaction-flow/input/ProfileEditor/ProfileEditor.test.tsx +++ b/src/transaction-flow/input/ProfileEditor/ProfileEditor.test.tsx @@ -42,7 +42,7 @@ const mockProfileData = { { key: 'com.discord', type: 'text', - value: 'test#1234', + value: 'test', }, { key: 'com.reddit', From c8bc980d5b754885bc92b0434e4c946d7e6334d0 Mon Sep 17 00:00:00 2001 From: Luc Date: Wed, 9 Aug 2023 13:55:38 +0000 Subject: [PATCH 2/5] Bump to new username --- e2e/specs/stateful/profile.spec.ts | 2 +- public/locales/en/register.json | 2 +- public/locales/en/transactionFlow.json | 2 +- public/locales/nl/transactionFlow.json | 2 +- public/locales/zh/register.json | 2 +- public/locales/zh/transactionFlow.json | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/e2e/specs/stateful/profile.spec.ts b/e2e/specs/stateful/profile.spec.ts index 4cacd8fee..86d2e2e80 100644 --- a/e2e/specs/stateful/profile.spec.ts +++ b/e2e/specs/stateful/profile.spec.ts @@ -29,7 +29,7 @@ const profiles = [ { type: 'account', key: 'com.discord', - value: 'lucemans', + value: 'futurealisha', }, { type: 'account', diff --git a/public/locales/en/register.json b/public/locales/en/register.json index 8597d8579..3fc876c1c 100644 --- a/public/locales/en/register.json +++ b/public/locales/en/register.json @@ -67,7 +67,7 @@ "placeholder": { "com.twitter": "e.g. ensdomains", "com.github": "e.g. ensdomains", - "com.discord": "e.g. lucemans", + "com.discord": "e.g. futurealisha", "org.telegram": "e.g. futurealisha", "email": "e.g. hello@example.com" } diff --git a/public/locales/en/transactionFlow.json b/public/locales/en/transactionFlow.json index 57315b313..fb1c0303e 100644 --- a/public/locales/en/transactionFlow.json +++ b/public/locales/en/transactionFlow.json @@ -55,7 +55,7 @@ "default": "Add username here", "com.twitter": "e.g. ensdomains", "com.github": "e.g. ensdomains", - "com.discord": "e.g. lucemans", + "com.discord": "e.g. futurealisha", "org.telegram": "e.g. futurealisha", "email": "e.g. hello@example.com" } diff --git a/public/locales/nl/transactionFlow.json b/public/locales/nl/transactionFlow.json index 334e10f81..4c910a29c 100644 --- a/public/locales/nl/transactionFlow.json +++ b/public/locales/nl/transactionFlow.json @@ -54,7 +54,7 @@ "default": "Voeg username hier toe", "com.twitter": "e.g. ensdomains", "com.github": "e.g. ensdomains", - "com.discord": "e.g. lucemans" + "com.discord": "e.g. futurealisha" } }, "address": { diff --git a/public/locales/zh/register.json b/public/locales/zh/register.json index 3be03b86b..090e8acd3 100644 --- a/public/locales/zh/register.json +++ b/public/locales/zh/register.json @@ -65,7 +65,7 @@ "placeholder": { "com.twitter": "例如 ensdomains", "com.github": "例如 ensdomains", - "com.discord": "例如 lucemans" + "com.discord": "例如 futurealisha" } }, "address": { diff --git a/public/locales/zh/transactionFlow.json b/public/locales/zh/transactionFlow.json index a589801fc..926755029 100644 --- a/public/locales/zh/transactionFlow.json +++ b/public/locales/zh/transactionFlow.json @@ -55,7 +55,7 @@ "default": "在此添加用户名", "com.twitter": "例如 ensdomains", "com.github": "例如 ensdomains", - "com.discord": "例如 lucemans" + "com.discord": "例如 futurealisha" } }, "address": { From d61247bf4511664bc99677c871ab3a0e6817cfb9 Mon Sep 17 00:00:00 2001 From: Luc Date: Wed, 9 Aug 2023 14:07:35 +0000 Subject: [PATCH 3/5] Bump to new username --- e2e/specs/stateful/profile.spec.ts | 2 +- public/locales/en/register.json | 4 ++-- public/locales/en/transactionFlow.json | 8 ++++---- public/locales/nl/transactionFlow.json | 2 +- public/locales/zh/register.json | 7 ++++--- public/locales/zh/transactionFlow.json | 6 +++--- 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/e2e/specs/stateful/profile.spec.ts b/e2e/specs/stateful/profile.spec.ts index 86d2e2e80..7013c915c 100644 --- a/e2e/specs/stateful/profile.spec.ts +++ b/e2e/specs/stateful/profile.spec.ts @@ -29,7 +29,7 @@ const profiles = [ { type: 'account', key: 'com.discord', - value: 'futurealisha', + value: 'nickjohnson', }, { type: 'account', diff --git a/public/locales/en/register.json b/public/locales/en/register.json index 3fc876c1c..49bc14578 100644 --- a/public/locales/en/register.json +++ b/public/locales/en/register.json @@ -67,8 +67,8 @@ "placeholder": { "com.twitter": "e.g. ensdomains", "com.github": "e.g. ensdomains", - "com.discord": "e.g. futurealisha", - "org.telegram": "e.g. futurealisha", + "com.discord": "e.g. nickjohnson", + "org.telegram": "e.g. nicksdjohnson", "email": "e.g. hello@example.com" } }, diff --git a/public/locales/en/transactionFlow.json b/public/locales/en/transactionFlow.json index fb1c0303e..db1548035 100644 --- a/public/locales/en/transactionFlow.json +++ b/public/locales/en/transactionFlow.json @@ -53,10 +53,10 @@ "noOptions": "No account options available", "placeholder": { "default": "Add username here", - "com.twitter": "e.g. ensdomains", - "com.github": "e.g. ensdomains", - "com.discord": "e.g. futurealisha", - "org.telegram": "e.g. futurealisha", + "com.twitter": "e.g. nicksdjohnson", + "com.github": "e.g. arachnid", + "com.discord": "e.g. nickjohnson", + "org.telegram": "e.g. nicksdjohnson", "email": "e.g. hello@example.com" } }, diff --git a/public/locales/nl/transactionFlow.json b/public/locales/nl/transactionFlow.json index 4c910a29c..aae480c3f 100644 --- a/public/locales/nl/transactionFlow.json +++ b/public/locales/nl/transactionFlow.json @@ -54,7 +54,7 @@ "default": "Voeg username hier toe", "com.twitter": "e.g. ensdomains", "com.github": "e.g. ensdomains", - "com.discord": "e.g. futurealisha" + "com.discord": "e.g. nickjohnson" } }, "address": { diff --git a/public/locales/zh/register.json b/public/locales/zh/register.json index 090e8acd3..f91bbf5a5 100644 --- a/public/locales/zh/register.json +++ b/public/locales/zh/register.json @@ -63,9 +63,10 @@ "com.discord": "Discord" }, "placeholder": { - "com.twitter": "例如 ensdomains", - "com.github": "例如 ensdomains", - "com.discord": "例如 futurealisha" + "com.twitter": "例如 nicksdjohnson", + "com.github": "例如 arachnid", + "com.discord": "例如 nickjohnson", + "org.telegram": "e.g. nicksdjohnson" } }, "address": { diff --git a/public/locales/zh/transactionFlow.json b/public/locales/zh/transactionFlow.json index 926755029..8d6ba3fda 100644 --- a/public/locales/zh/transactionFlow.json +++ b/public/locales/zh/transactionFlow.json @@ -53,9 +53,9 @@ "noOptions": "没有可用的账户", "placeholder": { "default": "在此添加用户名", - "com.twitter": "例如 ensdomains", - "com.github": "例如 ensdomains", - "com.discord": "例如 futurealisha" + "com.twitter": "例如 nicksdjohnson", + "com.github": "例如 arachnid", + "com.discord": "例如 nickjohnson" } }, "address": { From f407a11ced6d50122fe91dac86985fae43382a8d Mon Sep 17 00:00:00 2001 From: Luc Date: Wed, 9 Aug 2023 15:07:48 +0000 Subject: [PATCH 4/5] Basic Timezone Parser --- package.json | 2 ++ src/assets/social/DynamicSocialIcon.tsx | 2 ++ src/utils/getSocialData.ts | 30 +++++++++++++++++++++++++ 3 files changed, 34 insertions(+) diff --git a/package.json b/package.json index fe6a2c07c..60f20e9f2 100644 --- a/package.json +++ b/package.json @@ -83,6 +83,7 @@ "@tanstack/query-sync-storage-persister": "4.29.1", "@tanstack/react-query": "4.29.1", "@tanstack/react-query-persist-client": "4.29.1", + "@types/luxon": "^3.3.1", "@wagmi/core": "0.10.11", "calendar-link": "^2.2.0", "dns-packet": "^5.4.0", @@ -94,6 +95,7 @@ "intl-segmenter-polyfill": "^0.4.4", "iso-639-1": "^2.1.15", "lodash": "^4.17.21", + "luxon": "^3.4.0", "markdown-to-jsx": "^7.1.7", "next": "12.1.6", "p-memoize": "^7.1.1", diff --git a/src/assets/social/DynamicSocialIcon.tsx b/src/assets/social/DynamicSocialIcon.tsx index a50207d28..4c0ac7437 100644 --- a/src/assets/social/DynamicSocialIcon.tsx +++ b/src/assets/social/DynamicSocialIcon.tsx @@ -11,6 +11,7 @@ export const socialIconTypes = { 'com.twitter': dynamic(() => import('./SocialTwitter.svg')), 'com.youtube': dynamic(() => import('./SocialYoutube.svg')), 'org.telegram': dynamic(() => import('./SocialTelegram.svg')), + timezone: dynamic(() => import('@ensdomains/thorin').then((m) => m.MarkerSVG)), email: dynamic(() => import('@ensdomains/thorin').then((m) => m.EnvelopeSVG)), } @@ -22,6 +23,7 @@ export const socialIconColors = { 'com.twitter': '#65C5FC', 'com.youtube': '#FF0000', 'org.telegram': '#2BABEE', + timezone: '#000000', email: '#000000', } diff --git a/src/utils/getSocialData.ts b/src/utils/getSocialData.ts index 4e9cf2a44..fb9334ae8 100644 --- a/src/utils/getSocialData.ts +++ b/src/utils/getSocialData.ts @@ -1,3 +1,5 @@ +import { DateTime } from 'luxon' + export const getSocialData = (iconKey: string, value: string) => { switch (iconKey) { case 'twitter': @@ -47,6 +49,34 @@ export const getSocialData = (iconKey: string, value: string) => { value, type: 'copy', } + case 'timezone': + return { + icon: 'timezone', + color: '#2BABEE', + label: 'Timezone', + value: (() => { + try { + const zone = DateTime.now().setZone(value) + const now = DateTime.now().toLocal() + + // Number of minutes between now and the target zone + const minutes = zone.offset - now.offset + const absoluteMinutes = Math.abs(minutes) + + // To hour offset, 120 minutes = "+2:00", 90 minutes = "+1:30" including leading zeroes + const offset = `${minutes < 0 ? '-' : '+'}${Math.floor(absoluteMinutes / 60) + .toString() + .padStart(2, '0')}:${Math.abs(absoluteMinutes % 60) + .toString() + .padStart(2, '0')}` + + return `${value} (${offset})` + } catch { + // If unable to parse offset simply return the user-set value + return value + } + })(), + } default: return null } From d4b5954ecbba699037c0942ee87b5b91863d1663 Mon Sep 17 00:00:00 2001 From: Luc Date: Wed, 9 Aug 2023 15:10:58 +0000 Subject: [PATCH 5/5] Bump Record --- src/constants/supportedSocialRecordKeys.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constants/supportedSocialRecordKeys.json b/src/constants/supportedSocialRecordKeys.json index 15452a1f9..abc8dba4d 100644 --- a/src/constants/supportedSocialRecordKeys.json +++ b/src/constants/supportedSocialRecordKeys.json @@ -1 +1 @@ -["com.twitter", "com.github", "com.discord", "org.telegram", "email"] +["com.twitter", "com.github", "com.discord", "org.telegram", "email", "timezone"]