From f66dbe65348baf23f89f52726109684df0a32792 Mon Sep 17 00:00:00 2001 From: Wenderson Pires Date: Wed, 10 Apr 2024 11:32:32 -0300 Subject: [PATCH 1/4] clean code --- package.json | 2 +- src/components/ContactItems/index.tsx | 1 - src/index.tsx | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/package.json b/package.json index 09b15bd..4e4859f 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "deploy:testnet": "npm run build; alem deploy --network testnet" }, "dependencies": { - "alem": "^1.0.0-beta.14" + "alem": "^1.0.0-beta.15" }, "devDependencies": { "@types/styled-components": "^5.1.26", diff --git a/src/components/ContactItems/index.tsx b/src/components/ContactItems/index.tsx index 2cfd697..95d96b7 100644 --- a/src/components/ContactItems/index.tsx +++ b/src/components/ContactItems/index.tsx @@ -9,7 +9,6 @@ type Props = { onSelect?: (profileInfo: SimpleProfileInfo) => void; }; -// TODO: Criar uma forma no Router de deixar paginas pre-renderizadas const ContactItems = ({ accountIds, onSelect }: Props) => { const [items, setItems] = useState([]); const [ready, setReady] = useState(false); diff --git a/src/index.tsx b/src/index.tsx index 9403e46..1fa068d 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -13,7 +13,6 @@ const App = () => { useEffect(() => { // clean up storage if (!context.accountId) { - console.log("Shoud i go?"); cleanUpChatList(); } }, [context.accountId]); From 2b7a8cac28175f4a127be63c13e87c253e859720 Mon Sep 17 00:00:00 2001 From: Wenderson Pires Date: Fri, 26 Apr 2024 12:46:44 -0300 Subject: [PATCH 2/4] Update timeAgo.ts --- src/modules/TimeAgo/timeAgo.ts | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/modules/TimeAgo/timeAgo.ts b/src/modules/TimeAgo/timeAgo.ts index 0d2c14c..82c5715 100644 --- a/src/modules/TimeAgo/timeAgo.ts +++ b/src/modules/TimeAgo/timeAgo.ts @@ -1,16 +1,25 @@ import { UseModuleProps } from "alem"; import en from "./en"; +// TODO: Fazer video tutorial disso +// Code builder for "formatTimestamp" +const formatTimestampCode = (timestamp: number) => { + const code = ` + (() => { + TimeAgo.addDefaultLocale({ + ${en} + }); + + return new TimeAgo('en-US').format(new Date(${timestamp})); + })() +`; + return code; +}; + const timeAgo = { - moduleSetup: ` - TimeAgo.addDefaultLocale({ - ${en} - }) - `, formatTimestamp: (timestamp: number, onComplete: (data: string) => void) => ({ - setupCode: timeAgo.moduleSetup, - code: `new TimeAgo('en-US').format(new Date(${timestamp}))`, + code: formatTimestampCode(timestamp), onComplete, } as UseModuleProps), }; From a1c144dad3a9b6971eb170a231cd5916ea6ba4ad Mon Sep 17 00:00:00 2001 From: Wenderson Pires Date: Fri, 26 Apr 2024 12:57:07 -0300 Subject: [PATCH 3/4] alem beta 31 --- package.json | 2 +- yarn.lock | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 4e4859f..d793549 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "deploy:testnet": "npm run build; alem deploy --network testnet" }, "dependencies": { - "alem": "^1.0.0-beta.15" + "alem": "^1.0.0-beta.31" }, "devDependencies": { "@types/styled-components": "^5.1.26", diff --git a/yarn.lock b/yarn.lock index 626aff2..e56e998 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1139,10 +1139,10 @@ accepts@~1.3.4, accepts@~1.3.8: mime-types "~2.1.34" negotiator "0.6.3" -alem@^1.0.0-beta.9: - version "1.0.0-beta.9" - resolved "https://registry.yarnpkg.com/alem/-/alem-1.0.0-beta.9.tgz#bdf918b78f915a24c8c9ec2ed44657e99a940c4c" - integrity sha512-0GnKlV5fIICKUL+tEsDAgRef3+/agobBzK/tiZUWsT5iQr6eMTOssWRkkJz9d/4JX04GAYD+5FErjPf0cxs7dg== +alem@^1.0.0-beta.31: + version "1.0.0-beta.31" + resolved "https://registry.yarnpkg.com/alem/-/alem-1.0.0-beta.31.tgz#b440b1185371f2f1808c6cd9c4e66feac38f5b24" + integrity sha512-kOP+hJ3eHMWAmHoWHyjcO87kVNt5i//FTQKz4DmWy86bHDW3gyf7LyAp0lZYzObrD7tsVJ0pNkowQT2fSCeuwg== dependencies: "@babel/core" "^7.24.3" "@babel/plugin-syntax-jsx" "^7.24.1" @@ -1155,7 +1155,9 @@ alem@^1.0.0-beta.9: chokidar "^3.5.3" commander "^11.1.0" crypto-js "^4.2.0" + dotenv "^16.4.5" express "^4.18.2" + lodash "^4.17.21" mock-fs "^5.2.0" near-cli-rs "^0.4.3" node-html-parser "^6.1.12" @@ -1632,6 +1634,11 @@ domutils@^3.0.1: domelementtype "^2.3.0" domhandler "^5.0.3" +dotenv@^16.4.5: + version "16.4.5" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.4.5.tgz#cdd3b3b604cb327e286b4762e13502f717cb099f" + integrity sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg== + eastasianwidth@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb" @@ -2122,6 +2129,11 @@ lodash.debounce@^4.0.8: resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" integrity sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow== +lodash@^4.17.21: + version "4.17.21" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" + integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== + log-update@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/log-update/-/log-update-5.0.1.tgz#9e928bf70cb183c1f0c9e91d9e6b7115d597ce09" From 31d0bfa10ca185243a8db7bf8363c69430bd2872 Mon Sep 17 00:00:00 2001 From: Wenderson Pires Date: Fri, 26 Apr 2024 13:04:27 -0300 Subject: [PATCH 4/4] fix timeAgo --- src/modules/TimeAgo/timeAgo.ts | 38 +++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/src/modules/TimeAgo/timeAgo.ts b/src/modules/TimeAgo/timeAgo.ts index 82c5715..5e5ede9 100644 --- a/src/modules/TimeAgo/timeAgo.ts +++ b/src/modules/TimeAgo/timeAgo.ts @@ -3,23 +3,37 @@ import en from "./en"; // TODO: Fazer video tutorial disso // Code builder for "formatTimestamp" -const formatTimestampCode = (timestamp: number) => { - const code = ` - (() => { - TimeAgo.addDefaultLocale({ - ${en} - }); +// const formatTimestampCode = (timestamp: number) => { +// const code = ` +// (() => { +// TimeAgo.addDefaultLocale({ +// ${en} +// }); - return new TimeAgo('en-US').format(new Date(${timestamp})); - })() -`; - return code; -}; +// return new TimeAgo('en-US').format(new Date(${timestamp})); +// })() +// `; +// return code; +// }; + +// const timeAgo = { +// formatTimestamp: (timestamp: number, onComplete: (data: string) => void) => +// ({ +// code: formatTimestampCode(timestamp), +// onComplete, +// } as UseModuleProps), +// }; const timeAgo = { + moduleSetup: ` + TimeAgo.addDefaultLocale({ + ${en} + }) + `, formatTimestamp: (timestamp: number, onComplete: (data: string) => void) => ({ - code: formatTimestampCode(timestamp), + setupCode: timeAgo.moduleSetup, + code: `new TimeAgo('en-US').format(new Date(${timestamp}))`, onComplete, } as UseModuleProps), };