From e5e7969cd21a325fcc1916547533b25d3feccf91 Mon Sep 17 00:00:00 2001 From: Nengak Dakup Date: Tue, 30 Jan 2024 12:56:19 +0100 Subject: [PATCH 01/14] Added function getOrganizationByUuid --- src/store/main.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/store/main.ts b/src/store/main.ts index c3e18c01..2db47e66 100644 --- a/src/store/main.ts +++ b/src/store/main.ts @@ -2030,6 +2030,25 @@ export class MainStore { } } + //for a user who is not logged in + async getOrganizationByUuid(uuid: string): Promise { + try { + const r: any = await fetch(`${TribesURL}/organizations/${uuid}`, { + method: 'GET', + mode: 'cors', + headers: { + 'Content-Type': 'application/json' + } + }); + + const data = await r.json(); + return await data; + } catch (e) { + console.log('Error getOrganizationByUuid', e); + return undefined; + } + } + @action async addOrganization(body: CreateOrganizationInput): Promise { try { if (!uiStore.meInfo) return null; From a79ca74c5db747f3dfaea474a9bc379be2f53e05 Mon Sep 17 00:00:00 2001 From: Nengak Dakup Date: Tue, 30 Jan 2024 13:01:37 +0100 Subject: [PATCH 02/14] Added Orgnaization Title, Image, Links, Description --- src/pages/tickets/org/orgHeader/index.tsx | 213 ++++++++++++++++------ 1 file changed, 156 insertions(+), 57 deletions(-) diff --git a/src/pages/tickets/org/orgHeader/index.tsx b/src/pages/tickets/org/orgHeader/index.tsx index e8883144..76196025 100644 --- a/src/pages/tickets/org/orgHeader/index.tsx +++ b/src/pages/tickets/org/orgHeader/index.tsx @@ -1,4 +1,6 @@ import React, { useState, useEffect, useRef } from 'react'; +import { Organization } from 'store/main'; +import { useParams } from 'react-router-dom'; import styled from 'styled-components'; import { EuiCheckboxGroup, EuiPopover, EuiText } from '@elastic/eui'; import MaterialIcon from '@material/react-material-icon'; @@ -20,31 +22,124 @@ interface styledProps { color?: any; } const color = colors['light']; + +const FillContainer = styled.div` + width: 100vw; + display: flex; + justify-content: center; + align-self: stretch; + background: #fff; + border-bottom: 1px solid var(--Input-BG-1, #f2f3f5); +`; + const Header = styled.div` display: flex; + min-width: 1366px; height: 130px; - padding: 45px 20px 45px 130px; - justify-content: center; align-items: center; align-self: stretch; - border-bottom: 1px solid var(--Input-BG-1, #f2f3f5); + padding: 0 130px; background: #fff; + @media (max-width: 1140px) { + min-width: 90%; + padding: 0; + } `; -const UrlButtonContainer = styled.div` - width: 180px; +const OrgDetails = styled.div` display: flex; - gap: 8px; + flex: 4; justify-content: space-between; - margin-top: 40px; - margin-right: 690px; - margin-left: 0px; `; -const FillContainer = styled.div` - width: 100vw; - align-self: stretch; - background: #fff; +const ButtonContainer = styled.div` + display: flex; + flex: 1; + justify-content: flex-end; +`; + +const OrgDetailsLeft = styled.div` + display: flex; + +`; + +const OrgDetailsRight = styled.div` + display: flex; + justify-contents: flex-end; + align-items: center; + +`; + +const OrgLogo = styled.img` + width: 72px; + height: 72px; + border-radius: 66px; + +`; + +const OrgNameLinks = styled.div` + display: flex; + flex-direction: column; + justify-content: center; + margin-left: 20px; + +`; + +const OrgName = styled.p` + color: var(--Text-2, #3c3f41); + font-family: Barlow; + font-size: 28px; + font-style: normal; + font-weight: 700; + margin: 0; +`; + +const OrgLinks = styled.div` + display: flex; + flex-direction: row; + gap: 8px; +`; + +const SmallButton = styled.a` + border-radius: 4px; + border: 1px solid var(--Divider-2, #dde1e5); + display: flex; + width: auto; + height: 28px; + padding: 0px 10px 0px 7px; + align-items: center; + gap: 6px; + color: var(--Main-bottom-icons, #5f6368); + text-decoration: none; + cursor: pointer; + font-family: Barlow; + font-size: 13px; + font-style: normal; + font-weight: 500; + outline: none; + &:hover { + text-decoration: none; + color: var(--Main-bottom-icons, #5f6368); + border: 1px solid var(--Disabled-Icon-color, #B0B7BC); + } + &:focus { + outline: none; + } +`; +const OrgDetailsText = styled.div` + overflow: hidden; + color: var(--Main-bottom-icons, #5F6368); + text-align: right; + leading-trim: both; + text-edge: cap; + text-overflow: ellipsis; + font-family: Barlow; + font-size: 14px; + font-style: normal; + font-weight: 400; + line-height: 20px; + width: 403px; + `; const Filters = styled.div` @@ -98,28 +193,6 @@ const Button = styled.button` letter-spacing: 0.14px; `; -const UrlButton = styled.button` - border-radius: 4px; - margin-right: auto; - border: 1px solid #dde1e5; - background: #ffffff; - display: flex; - width: 85px; - height: 28px; - padding: 8px 16px; - justify-content: center; - align-items: center; - gap: 8px; - color: var(--Black, #5f6368); - text-align: center; - font-family: 'Barlow'; - font-size: 13px; - font-style: normal; - font-weight: 500; - line-height: 0px; /* 0% */ - letter-spacing: 0.14px; -`; - const FilterLabel = styled.label` color: var(--Main-bottom-icons, #5f6368); font-family: Barlow; @@ -425,6 +498,8 @@ export const OrgHeader = ({ const [isPostBountyModalOpen, setIsPostBountyModalOpen] = useState(false); const [filterClick, setFilterClick] = useState(false); const [isStatusPopoverOpen, setIsStatusPopoverOpen] = useState(false); + const [organization, setOrganization] = useState(); + const { uuid } = useParams<{ uuid: string }>(); const onButtonClick = async () => { setIsStatusPopoverOpen((isPopoverOpen: any) => !isPopoverOpen); }; @@ -458,6 +533,15 @@ export const OrgHeader = ({ } }, [org_uuid, checkboxIdToSelectedMap, main, languageString]); + useEffect(() => { + (async () => { + if (!uuid) return; + const res = await main.getOrganizationByUuid(uuid); + if (!res) return; + setOrganization(res); + })(); + }, [main, uuid]) + const handleClick = () => { setFilterClick(!filterClick); }; @@ -482,28 +566,43 @@ export const OrgHeader = ({ <>
- - {website !== '' ? ( - handleWebsiteButton(website)}> - - Website - - ) : ( - '' - )} - {github !== '' ? ( - handleGithubButton(github)}> - - Github - - ) : ( - '' - )} - - + + + + + {organization?.name || ''} + + { + organization?.github && + + globe-website icon + Website + + } + { + organization?.website && + + {' '} + github icon + Github + + } + + + + + + + {organization?.description || ''} + + + + + +
From 500d0b89796ae6f3700dbbcaa4e8a9f2df105120 Mon Sep 17 00:00:00 2001 From: Nengak Dakup Date: Tue, 30 Jan 2024 13:05:31 +0100 Subject: [PATCH 03/14] Added default company asset --- public/static/orgdefault.png | Bin 0 -> 4423 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 public/static/orgdefault.png diff --git a/public/static/orgdefault.png b/public/static/orgdefault.png new file mode 100644 index 0000000000000000000000000000000000000000..8f898860e001e9209d9416869cf90089f320cb49 GIT binary patch literal 4423 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 Date: Tue, 30 Jan 2024 13:08:29 +0100 Subject: [PATCH 04/14] Fixed text-wrap on Company name --- src/pages/tickets/org/orgHeader/index.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/tickets/org/orgHeader/index.tsx b/src/pages/tickets/org/orgHeader/index.tsx index 76196025..3e155277 100644 --- a/src/pages/tickets/org/orgHeader/index.tsx +++ b/src/pages/tickets/org/orgHeader/index.tsx @@ -92,6 +92,7 @@ const OrgName = styled.p` font-style: normal; font-weight: 700; margin: 0; + text-wrap: nowrap; `; const OrgLinks = styled.div` From 101e9db02862fdcd52b46be6252e2a40e3c0d0a2 Mon Sep 17 00:00:00 2001 From: Nengak Dakup Date: Tue, 30 Jan 2024 13:09:52 +0100 Subject: [PATCH 05/14] Added Organization mock data --- src/__test__/__mockData__/organization.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/__test__/__mockData__/organization.ts diff --git a/src/__test__/__mockData__/organization.ts b/src/__test__/__mockData__/organization.ts new file mode 100644 index 00000000..59d938a6 --- /dev/null +++ b/src/__test__/__mockData__/organization.ts @@ -0,0 +1,20 @@ +import { Organization } from 'store/main'; + +export const organizations: Organization[] = [ + { + created: "2024-01-18T17:10:43.329567Z", + deleted: false, + description: "This is a test organization for the Org Homepage Epic.", + github: "https://github.com/stakwork/sphinx-tribes", + id: "67", + img: "https://memes.sphinx.chat/public/UPWRvxiceSND60S9_7XwQGtj8MmPsQ1_ijX8aUR7kZ8=", + name: "E's Fun Club", + owner_pubkey: "021ae436bcd40ca21396e59be8cdb5a707ceacdb35c1d2c5f23be7584cab29c40b", + show: false, + updated: "2024-01-18T17:10:43.329567Z", + uuid: "cmkln4tm098m49vhlt80", + website: "https://ecurrencyhodler.com/", + } +]; + +export const organization = organizations[0]; \ No newline at end of file From 137ff7ac505750a631793aa93bd75e22fed4983e Mon Sep 17 00:00:00 2001 From: Nengak Dakup Date: Tue, 30 Jan 2024 13:16:49 +0100 Subject: [PATCH 06/14] Removed unused orglinks --- src/pages/tickets/org/orgHeader/index.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/pages/tickets/org/orgHeader/index.tsx b/src/pages/tickets/org/orgHeader/index.tsx index 3e155277..f52f651e 100644 --- a/src/pages/tickets/org/orgHeader/index.tsx +++ b/src/pages/tickets/org/orgHeader/index.tsx @@ -492,8 +492,7 @@ export const OrgHeader = ({ onChangeStatus, checkboxIdToSelectedMap, org_uuid, - languageString, - organizationUrls + languageString }: OrgBountyHeaderProps) => { const { main } = useStores(); const [isPostBountyModalOpen, setIsPostBountyModalOpen] = useState(false); @@ -508,7 +507,6 @@ export const OrgHeader = ({ const selectedWidget = 'wanted'; const filterRef = useRef(null); - const { website, github } = organizationUrls; const handlePostBountyClick = () => { setIsPostBountyModalOpen(true); }; From e551f468d21a8811b002d4ca703bb5eac64880ec Mon Sep 17 00:00:00 2001 From: Nengak Dakup Date: Tue, 30 Jan 2024 19:10:32 +0100 Subject: [PATCH 07/14] Added Component test --- .../__tests__/OrgHeaderComponent.spec.tsx | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/pages/tickets/org/orgHeader/__tests__/OrgHeaderComponent.spec.tsx diff --git a/src/pages/tickets/org/orgHeader/__tests__/OrgHeaderComponent.spec.tsx b/src/pages/tickets/org/orgHeader/__tests__/OrgHeaderComponent.spec.tsx new file mode 100644 index 00000000..b9dab1f5 --- /dev/null +++ b/src/pages/tickets/org/orgHeader/__tests__/OrgHeaderComponent.spec.tsx @@ -0,0 +1,41 @@ +import '@testing-library/jest-dom'; +import { render, screen, waitFor } from '@testing-library/react'; +import nock from 'nock'; +import React from 'react'; +import { organizations } from '__test__/__mockData__/organization'; +import {OrgHeader} from '../index'; +import {defaultOrgBountyStatus} from '../../../../../store/main' + +const organization = organizations[0]; + +jest.mock('react-router-dom', () => ({ + ...jest.requireActual('react-router-dom'), + useParams: () => ({ + uuid: "cmkln4tm098m49vhlt80", + id: '67' + }) +})); + +describe('OrgHeader Component', () => { + it('renders the component with organization logo and name', async () => { + const url = 'https://people-test.sphinx.chat'; + + nock(url).get(`/organizations/${organization.uuid}`).reply(200, organization); + + render( + + ); + + + waitFor(() => expect(screen.findByText(organization.name)).toBeInTheDocument()); + waitFor(() => expect(screen.findByAltText(`${organization.name} logo`)).toBeInTheDocument()); + }); +}); \ No newline at end of file From f200bea667b6eab0ab0f9951516e5f9f170fe7e1 Mon Sep 17 00:00:00 2001 From: Nengak Dakup Date: Thu, 1 Feb 2024 17:11:20 +0100 Subject: [PATCH 08/14] Removed unecessary useParams to get org_uuid --- src/pages/tickets/org/orgHeader/index.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/pages/tickets/org/orgHeader/index.tsx b/src/pages/tickets/org/orgHeader/index.tsx index f52f651e..fc4719e0 100644 --- a/src/pages/tickets/org/orgHeader/index.tsx +++ b/src/pages/tickets/org/orgHeader/index.tsx @@ -1,6 +1,5 @@ import React, { useState, useEffect, useRef } from 'react'; import { Organization } from 'store/main'; -import { useParams } from 'react-router-dom'; import styled from 'styled-components'; import { EuiCheckboxGroup, EuiPopover, EuiText } from '@elastic/eui'; import MaterialIcon from '@material/react-material-icon'; @@ -499,7 +498,6 @@ export const OrgHeader = ({ const [filterClick, setFilterClick] = useState(false); const [isStatusPopoverOpen, setIsStatusPopoverOpen] = useState(false); const [organization, setOrganization] = useState(); - const { uuid } = useParams<{ uuid: string }>(); const onButtonClick = async () => { setIsStatusPopoverOpen((isPopoverOpen: any) => !isPopoverOpen); }; @@ -534,12 +532,12 @@ export const OrgHeader = ({ useEffect(() => { (async () => { - if (!uuid) return; - const res = await main.getOrganizationByUuid(uuid); + if (!org_uuid) return; + const res = await main.getOrganizationByUuid(org_uuid); if (!res) return; setOrganization(res); })(); - }, [main, uuid]) + }, [main, org_uuid]) const handleClick = () => { setFilterClick(!filterClick); From dc052a3aae0b73c4354e8c97a4a559baa95749a9 Mon Sep 17 00:00:00 2001 From: Nengak Dakup Date: Thu, 1 Feb 2024 17:22:27 +0100 Subject: [PATCH 09/14] Modified orgUrls to ordData --- src/pages/tickets/org/OrgTickets.tsx | 8 ++++---- .../org/orgHeader/__tests__/OrgHeaderComponent.spec.tsx | 2 +- src/people/interfaces.ts | 2 +- src/people/widgetViews/__tests__/OrgHeader.spec.tsx | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/pages/tickets/org/OrgTickets.tsx b/src/pages/tickets/org/OrgTickets.tsx index a424949c..59e4c341 100644 --- a/src/pages/tickets/org/OrgTickets.tsx +++ b/src/pages/tickets/org/OrgTickets.tsx @@ -24,7 +24,7 @@ function OrgBodyComponent() { const [checkboxIdToSelectedMapLanguage, setCheckboxIdToSelectedMapLanguage] = useState({}); const { uuid } = useParams<{ uuid: string; bountyId: string }>(); const [languageString, setLanguageString] = useState(''); - const [organizationUrls, setOrganizationUrls] = useState({}); + const [organizationData, setOrganizationData] = useState({}); const color = colors['light']; @@ -42,8 +42,8 @@ function OrgBodyComponent() { resetPage: true, languages: languageString }); - const orgUrls = await api.get(`organizations/${uuid}`); - setOrganizationUrls(orgUrls); + const orgData = await api.get(`organizations/${uuid}`); + setOrganizationData(orgData); } setLoading(false); })(); @@ -167,7 +167,7 @@ function OrgBodyComponent() { }} > { render( Date: Thu, 1 Feb 2024 17:46:58 +0100 Subject: [PATCH 10/14] Removed unecessary functions from Orgheader Component --- src/pages/tickets/org/orgHeader/index.tsx | 25 ++++++++--------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/src/pages/tickets/org/orgHeader/index.tsx b/src/pages/tickets/org/orgHeader/index.tsx index fc4719e0..cafbb8be 100644 --- a/src/pages/tickets/org/orgHeader/index.tsx +++ b/src/pages/tickets/org/orgHeader/index.tsx @@ -1,5 +1,4 @@ import React, { useState, useEffect, useRef } from 'react'; -import { Organization } from 'store/main'; import styled from 'styled-components'; import { EuiCheckboxGroup, EuiPopover, EuiText } from '@elastic/eui'; import MaterialIcon from '@material/react-material-icon'; @@ -486,6 +485,7 @@ const StatusContainer = styled.div` const Status = ['Open', 'Assigned', 'Completed', 'Paid']; export const OrgHeader = ({ + organizationData, onChangeLanguage, checkboxIdToSelectedMapLanguage, onChangeStatus, @@ -497,7 +497,6 @@ export const OrgHeader = ({ const [isPostBountyModalOpen, setIsPostBountyModalOpen] = useState(false); const [filterClick, setFilterClick] = useState(false); const [isStatusPopoverOpen, setIsStatusPopoverOpen] = useState(false); - const [organization, setOrganization] = useState(); const onButtonClick = async () => { setIsStatusPopoverOpen((isPopoverOpen: any) => !isPopoverOpen); }; @@ -530,14 +529,6 @@ export const OrgHeader = ({ } }, [org_uuid, checkboxIdToSelectedMap, main, languageString]); - useEffect(() => { - (async () => { - if (!org_uuid) return; - const res = await main.getOrganizationByUuid(org_uuid); - if (!res) return; - setOrganization(res); - })(); - }, [main, org_uuid]) const handleClick = () => { setFilterClick(!filterClick); @@ -565,20 +556,20 @@ export const OrgHeader = ({
- + - {organization?.name || ''} + {organizationData?.name || ''} { - organization?.github && - + organizationData?.github && + globe-website icon Website } { - organization?.website && - + organizationData?.website && + {' '} github icon Github @@ -590,7 +581,7 @@ export const OrgHeader = ({ - {organization?.description || ''} + {organizationData?.description || ''} From 0b40de0cb7284a16bfd969c459f7558899923de9 Mon Sep 17 00:00:00 2001 From: Nengak Dakup Date: Thu, 1 Feb 2024 17:55:27 +0100 Subject: [PATCH 11/14] Added test-id --- src/pages/tickets/org/orgHeader/index.tsx | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/pages/tickets/org/orgHeader/index.tsx b/src/pages/tickets/org/orgHeader/index.tsx index cafbb8be..06f765c0 100644 --- a/src/pages/tickets/org/orgHeader/index.tsx +++ b/src/pages/tickets/org/orgHeader/index.tsx @@ -97,6 +97,7 @@ const OrgLinks = styled.div` display: flex; flex-direction: row; gap: 8px; + margin-left: 0px; `; const SmallButton = styled.a` @@ -510,13 +511,6 @@ export const OrgHeader = ({ const handlePostBountyClose = () => { setIsPostBountyModalOpen(false); }; - const handleWebsiteButton = (websiteUrl: string) => { - window.open(websiteUrl, '_blank'); - }; - - const handleGithubButton = (githubUrl: string) => { - window.open(githubUrl, '_blank'); - }; useEffect(() => { if (org_uuid) { @@ -559,7 +553,7 @@ export const OrgHeader = ({ {organizationData?.name || ''} - + { organizationData?.github && From 7f0e09778ad1f57140ebc3ee6768cf22c986215a Mon Sep 17 00:00:00 2001 From: Nengak Dakup Date: Thu, 1 Feb 2024 17:55:58 +0100 Subject: [PATCH 12/14] Added tests for org logo and name --- .../widgetViews/__tests__/OrgHeader.spec.tsx | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/people/widgetViews/__tests__/OrgHeader.spec.tsx b/src/people/widgetViews/__tests__/OrgHeader.spec.tsx index cdce8a6b..6085b257 100644 --- a/src/people/widgetViews/__tests__/OrgHeader.spec.tsx +++ b/src/people/widgetViews/__tests__/OrgHeader.spec.tsx @@ -17,8 +17,18 @@ const MockProps: OrgBountyHeaderProps = { onChangeStatus: jest.fn(), onChangeLanguage: jest.fn(), organizationData: { - github: 'https://github.com/stakwork/sphinx-tribes', - website: 'https://ecurrencyhodler.com/' + created: "2024-01-18T17:10:43.329567Z", + deleted: false, + description: "This is a test organization for the Org Homepage Epic.", + github: "https://github.com/stakwork/sphinx-tribes", + id: "67", + img: "https://memes.sphinx.chat/public/UPWRvxiceSND60S9_7XwQGtj8MmPsQ1_ijX8aUR7kZ8=", + name: "E's Fun Club", + owner_pubkey: "021ae436bcd40ca21396e59be8cdb5a707ceacdb35c1d2c5f23be7584cab29c40b", + show: false, + updated: "2024-01-18T17:10:43.329567Z", + uuid: "cmkln4tm098m49vhlt80", + website: "https://ecurrencyhodler.com/", } }; describe('OrgHeader Component', () => { @@ -97,4 +107,10 @@ describe('OrgHeader Component', () => { const containerStyle = window.getComputedStyle(urlButtonContainer); expect(containerStyle.marginLeft).toBe('0px'); }); + + it('renders the component with organization logo and name', async () => { + render( ); + waitFor(() => expect(screen.findByText(MockProps.organizationData.name)).toBeInTheDocument()); + waitFor(() => expect(screen.findByAltText(`${MockProps.organizationData.name} logo`)).toBeInTheDocument()); + }); }); From befa4eeb6c60cd578c5cc2084d8e3739ad3eae4d Mon Sep 17 00:00:00 2001 From: Nengak Dakup Date: Thu, 1 Feb 2024 17:59:07 +0100 Subject: [PATCH 13/14] Deleted unecessary test --- .../__tests__/OrgHeaderComponent.spec.tsx | 41 ------------------- 1 file changed, 41 deletions(-) delete mode 100644 src/pages/tickets/org/orgHeader/__tests__/OrgHeaderComponent.spec.tsx diff --git a/src/pages/tickets/org/orgHeader/__tests__/OrgHeaderComponent.spec.tsx b/src/pages/tickets/org/orgHeader/__tests__/OrgHeaderComponent.spec.tsx deleted file mode 100644 index f27861e2..00000000 --- a/src/pages/tickets/org/orgHeader/__tests__/OrgHeaderComponent.spec.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import '@testing-library/jest-dom'; -import { render, screen, waitFor } from '@testing-library/react'; -import nock from 'nock'; -import React from 'react'; -import { organizations } from '__test__/__mockData__/organization'; -import {OrgHeader} from '../index'; -import {defaultOrgBountyStatus} from '../../../../../store/main' - -const organization = organizations[0]; - -jest.mock('react-router-dom', () => ({ - ...jest.requireActual('react-router-dom'), - useParams: () => ({ - uuid: "cmkln4tm098m49vhlt80", - id: '67' - }) -})); - -describe('OrgHeader Component', () => { - it('renders the component with organization logo and name', async () => { - const url = 'https://people-test.sphinx.chat'; - - nock(url).get(`/organizations/${organization.uuid}`).reply(200, organization); - - render( - - ); - - - waitFor(() => expect(screen.findByText(organization.name)).toBeInTheDocument()); - waitFor(() => expect(screen.findByAltText(`${organization.name} logo`)).toBeInTheDocument()); - }); -}); \ No newline at end of file From 50671ff44728dc8efc14484b94c2b289e7633f2c Mon Sep 17 00:00:00 2001 From: Nengak Dakup Date: Thu, 1 Feb 2024 18:21:21 +0100 Subject: [PATCH 14/14] Fix minor issue --- src/pages/tickets/org/orgHeader/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/tickets/org/orgHeader/index.tsx b/src/pages/tickets/org/orgHeader/index.tsx index abe8ed8c..14219da3 100644 --- a/src/pages/tickets/org/orgHeader/index.tsx +++ b/src/pages/tickets/org/orgHeader/index.tsx @@ -597,7 +597,7 @@ export const OrgHeader = ({ {canPostBounty && ( -