diff --git a/playwright-tests/tests/community.spec.js b/playwright-tests/tests/community.spec.js index c42ddc331..fc29c3db9 100644 --- a/playwright-tests/tests/community.spec.js +++ b/playwright-tests/tests/community.spec.js @@ -1,12 +1,10 @@ import { test, expect } from "@playwright/test"; test("should load a community page if handle exists", async ({ page }) => { - await page.goto( - "/devgovgigs.near/widget/app?page=community&handle=devhub-test" - ); + await page.goto("/devhub.near/widget/app?page=community&handle=devhub-test"); // Using the that wraps the tabs to identify a community page loaded - const communityTabSelector = `a[href^="/devgovgigs.near/widget/app?page=community&handle=devhub-test&tab="]`; + const communityTabSelector = `a[href^="/devhub.near/widget/app?page=community&handle=devhub-test&tab="]`; // Wait for the tab to be visible await page.waitForSelector(communityTabSelector, { @@ -44,7 +42,7 @@ test.describe("Wallet is connected", () => { page, }) => { await page.goto( - "/devgovgigs.near/widget/app?page=community&handle=devhub-test" + "/devhub.near/widget/app?page=community&handle=devhub-test" ); const postButtonSelector = 'a:has-text("Post")'; @@ -61,7 +59,7 @@ test.describe("Wallet is connected", () => { // Verify that the URL is the expected one. expect(page.url()).toBe( - "http://localhost:8080/devgovgigs.near/widget/app?page=create&labels=devhub-test" + "http://localhost:8080/devhub.near/widget/app?page=create&labels=devhub-test" ); // Wait for the Typeahead field to render. diff --git a/src/devhub/entity/addon/telegram/Viewer.jsx b/src/devhub/entity/addon/telegram/Viewer.jsx index 4959daf74..122fd32a4 100644 --- a/src/devhub/entity/addon/telegram/Viewer.jsx +++ b/src/devhub/entity/addon/telegram/Viewer.jsx @@ -18,34 +18,39 @@ if (!handles || handles.length === 0) { } else { return (
- {(handles || []).map((tg) => ( - <> - - - - { + const pattern = /https:\/\/t.me\/(.*)/; + const includesHttp = tg.match(pattern); + const handle = includesHttp ? includesHttp[1] : tg; + return ( + <> + + + + + + + ); + })}
); } diff --git a/src/devhub/page/community/index.jsx b/src/devhub/page/community/index.jsx index a73625168..c4667d364 100644 --- a/src/devhub/page/community/index.jsx +++ b/src/devhub/page/community/index.jsx @@ -110,6 +110,14 @@ function trimHttps(url) { return url; } +// some communties have url as handle (eg: devhub platform) while others has correct handle +function checkTelegramHandle(tg) { + const pattern = /https:\/\/t.me\/(.*)/; + const includesHttp = tg.match(pattern); + const handle = includesHttp ? includesHttp[1] : tg; + return { handle, url: "https://t.me/" + handle }; +} + const socialLinks = [ ...((community.website_url?.length ?? 0) > 0 ? [ @@ -141,13 +149,15 @@ const socialLinks = [ ] : []), - // ...(community.telegram_handle.length > 0 - // ? community.telegram_handle.map((telegram_handle) => ({ - // href: `https://t.me/${telegram_handle}`, - // iconClass: "bi bi-telegram", - // name: telegram_handle, - // })) - // : []), + ...(community.telegram_handle?.length > 0 + ? [ + { + href: checkTelegramHandle(community.telegram_handle).url, + iconClass: "bi bi-telegram", + name: checkTelegramHandle(community.telegram_handle).handle, + }, + ] + : []), ]; const NavlinksContainer = styled.div` diff --git a/src/devhub/page/create.jsx b/src/devhub/page/create.jsx index 70a1c62eb..54ecdb65e 100644 --- a/src/devhub/page/create.jsx +++ b/src/devhub/page/create.jsx @@ -2,7 +2,7 @@ State.init({ seekingFunding: false, author_id: context.accountId, // Should be a list of objects with field "name". - labels, + labels: [], // Should be a list of labels as strings. // Both of the label structures should be modified together. labelStrings: [], @@ -96,6 +96,10 @@ const labels = labelStrings.map((s) => { return { name: s }; }); +State.update({ + labels, +}); + if (state.waitForDraftStateRestore) { const draftstatestring = Storage.privateGet(DRAFT_STATE_STORAGE_KEY); if (draftstatestring != null) {