From bf12450275f120e684861c1e304487b4ad1b89f6 Mon Sep 17 00:00:00 2001 From: Tushar Vyas <89837102+Vayras@users.noreply.github.com> Date: Wed, 24 Jan 2024 09:06:54 +0530 Subject: [PATCH 01/15] Org Filter by Skill --- src/pages/tickets/org/OrgTickets.tsx | 30 ++- .../org/orgHeader/Icons/dropwDownIcon.svg | 8 + src/pages/tickets/org/orgHeader/index.tsx | 203 +++++++++++++++--- .../widgetViews/__tests__/OrgHeader.spec.tsx | 59 ++++- src/store/main.ts | 24 ++- 5 files changed, 280 insertions(+), 44 deletions(-) create mode 100644 src/pages/tickets/org/orgHeader/Icons/dropwDownIcon.svg diff --git a/src/pages/tickets/org/OrgTickets.tsx b/src/pages/tickets/org/OrgTickets.tsx index 60a38272..72c98eb7 100644 --- a/src/pages/tickets/org/OrgTickets.tsx +++ b/src/pages/tickets/org/OrgTickets.tsx @@ -21,6 +21,7 @@ function OrgBodyComponent() { const [checkboxIdToSelectedMap, setCheckboxIdToSelectedMap] = useState({}); const [checkboxIdToSelectedMapLanguage, setCheckboxIdToSelectedMapLanguage] = useState({}); const { uuid } = useParams<{ uuid: string; bountyId: string }>(); + const [languageString, setLanguageString] = useState(''); const color = colors['light']; @@ -33,11 +34,15 @@ function OrgBodyComponent() { await main.getBadgeList(); await main.getPeople(); if (uuid) { - await main.getOrganizationBounties(uuid, { page: 1, resetPage: true }); + await main.getOrganizationBounties(uuid, { + page: 1, + resetPage: true, + languages: languageString + }); } setLoading(false); })(); - }, [main, uuid]); + }, [main, uuid, checkboxIdToSelectedMap, languageString]); useEffect(() => { setCheckboxIdToSelectedMap({ @@ -63,14 +68,17 @@ function OrgBodyComponent() { setCheckboxIdToSelectedMap(newCheckboxIdToSelectedMap); }; - const onChangeLanguage = (optionId: any) => { + const onChangeLanguage = (optionId: number) => { const newCheckboxIdToSelectedMapLanguage = { ...checkboxIdToSelectedMapLanguage, - ...{ - [optionId]: !checkboxIdToSelectedMapLanguage[optionId] - } + [optionId]: !checkboxIdToSelectedMapLanguage[optionId] }; setCheckboxIdToSelectedMapLanguage(newCheckboxIdToSelectedMapLanguage); + const languageString = Object.keys(newCheckboxIdToSelectedMapLanguage) + .filter((key: string) => newCheckboxIdToSelectedMapLanguage[key]) + .join(','); + setLanguageString(languageString); + main.setBountyLanguages(languageString); }; const onPanelClick = (person: any, item: any) => { @@ -151,7 +159,14 @@ function OrgBodyComponent() { height: 'calc(100% - 65px)' }} > - + <>
diff --git a/src/pages/tickets/org/orgHeader/Icons/dropwDownIcon.svg b/src/pages/tickets/org/orgHeader/Icons/dropwDownIcon.svg new file mode 100644 index 00000000..a2cc09b8 --- /dev/null +++ b/src/pages/tickets/org/orgHeader/Icons/dropwDownIcon.svg @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/pages/tickets/org/orgHeader/index.tsx b/src/pages/tickets/org/orgHeader/index.tsx index c1cc2a82..a83cdf4c 100644 --- a/src/pages/tickets/org/orgHeader/index.tsx +++ b/src/pages/tickets/org/orgHeader/index.tsx @@ -1,9 +1,22 @@ -import React, { useState } from 'react'; +import React, { useState, useEffect, useRef } from 'react'; import styled from 'styled-components'; import { PostModal } from 'people/widgetViews/postBounty/PostModal'; +import { EuiCheckboxGroup } from '@elastic/eui'; +import { GetValue, coding_languages } from 'people/utils/languageLabelStyle'; +import { BountyHeaderProps } from 'people/interfaces'; +import { colors } from 'config'; import addBounty from './Icons/addBounty.svg'; import searchIcon from './Icons/searchIcon.svg'; import file from './Icons/file.svg'; +import dropdown from './Icons/dropwDownIcon.svg'; + +const Coding_Languages = GetValue(coding_languages); + +interface styledProps { + color?: any; +} + +const color = colors['light']; const Header = styled.div` width: 1366px; @@ -45,23 +58,19 @@ const FiltersRight = styled.span` flex: 1 0 0; width: 1366px; `; + const StatusContainer = styled.span` - padding: 10px 0px; + padding: 7px 0px; align-items: center; - gap: 4px; -`; -const Status = styled.select` - background-color: transparent; - border: none; + display: flex; + position: relative; `; + const SkillContainer = styled.span` - padding: 10px 0px; + padding: 7px 0px; align-items: center; - gap: 4px; -`; -const Skill = styled.select` - border: none; - background-color: transparent; + display: flex; + position: relative; `; const Button = styled.button` @@ -86,7 +95,7 @@ const Button = styled.button` letter-spacing: 0.14px; `; -const Label = styled.label` +const Label = styled.p` color: var(--Main-bottom-icons, #5f6368); font-family: Barlow; font-size: 15px; @@ -126,14 +135,12 @@ const SearchBar = styled.input` `; const SoryByContainer = styled.span` + padding: 7px 0px; + display: flex; justify-content: center; align-items: center; - gap: 4px; -`; -const SortBy = styled.select` - background-color: transparent; - border: none; `; + const NumberOfBounties = styled.div` height: 23px; padding: 1.5px 983.492px 1.5px 10px; @@ -170,9 +177,103 @@ const Img = styled.img` padding-bottom: 10px; `; -export const OrgHeader = () => { +const SkillFilter = styled.div` + width: 480px; + height: 280px; + background-color: white; + position: absolute; + top: 50px; + z-index: 999; + border-radius: 0px 0px 6px 6px; + border-right: 1px solid rgba(0, 0, 0, 0.1); + border-bottom: 1px solid rgba(0, 0, 0, 0.1); + border-left: 1px solid rgba(0, 0, 0, 0.1); + background: #fff; + box-shadow: 0px 2px 8px 0px rgba(0, 0, 0, 0.12); + + /* border-top: 3px solid var(--Primary-blue, #618AFF); + border-top-height: 20px; */ + + ::after { + content: ''; + position: absolute; + left: 0; + right: 380px; + top: 0; + height: 3px; + background: var(--Primary-blue, #618aff); + } +`; +const InternalContainer = styled.div` + display: flex; + flex-direction: column; + justify-content: center; + align-items: flex-start; + gap: 30px; + padding: 24px 20px 28px 20px; +`; + +const EuiPopOverCheckboxRight = styled.div` + height: auto; + user-select: none; + &.CheckboxOuter > div { + height: 100%; + display: grid; + grid-template-columns: 1fr 1fr 1fr; + column-gap: 56px; + justify-content: center; + .euiCheckboxGroup__item { + .euiCheckbox__square { + top: 5px; + border: 1px solid ${(p: any) => p?.color && p?.color?.grayish.G500}; + border-radius: 2px; + } + .euiCheckbox__input + .euiCheckbox__square { + background: ${(p: any) => p?.color && p?.color?.pureWhite} no-repeat center; + } + .euiCheckbox__input:checked + .euiCheckbox__square { + border: 1px solid ${(p: any) => p?.color && p?.color?.blue1}; + background: ${(p: any) => p?.color && p?.color?.blue1} no-repeat center; + background-image: url('static/checkboxImage.svg'); + } + .euiCheckbox__label { + font-family: 'Barlow'; + font-style: normal; + font-weight: 500; + font-size: 13px; + line-height: 18px; + color: ${(p: any) => p?.color && p?.color?.grayish.G50}; + &:hover { + color: ${(p: any) => p?.color && p?.color?.grayish.G05}; + } + } + input.euiCheckbox__input:checked ~ label { + color: ${(p: any) => p?.color && p?.color?.blue1}; + } + } + } +`; + +const DropDownButton = styled.button` + border: none; + background-color: transparent; + padding-top: 5px; +`; + +const FiltersLeft = styled.span` + display: flex; + height: 40px; + align-items: flex-start; +`; + +export const OrgHeader = ({ + onChangeLanguage, + checkboxIdToSelectedMapLanguage +}: BountyHeaderProps) => { const [isPostBountyModalOpen, setIsPostBountyModalOpen] = useState(false); + const [filterClick, setFilterClick] = useState(false); const selectedWidget = 'wanted'; + const filterRef = useRef(null); const handlePostBountyClick = () => { setIsPostBountyModalOpen(true); }; @@ -180,6 +281,26 @@ export const OrgHeader = () => { setIsPostBountyModalOpen(false); }; + const handleClick = () => { + setFilterClick(!filterClick); + }; + + useEffect(() => { + const handleWindowClick = (event: MouseEvent) => { + if (filterRef.current && !filterRef.current.contains(event.target as Node)) { + setFilterClick(false); + } + }; + if (filterClick) { + window.addEventListener('click', handleWindowClick); + } else { + window.removeEventListener('click', handleWindowClick); + } + return () => { + window.removeEventListener('click', handleWindowClick); + }; + }, [filterClick]); + return ( <> @@ -194,22 +315,48 @@ export const OrgHeader = () => { - - + + + {' '} + + - - + + + {' '} + + + {filterClick ? ( + + + + { + onChangeLanguage(id); + }} + /> + + + + ) : null} - - - - + + + + + {' '} + + + + diff --git a/src/people/widgetViews/__tests__/OrgHeader.spec.tsx b/src/people/widgetViews/__tests__/OrgHeader.spec.tsx index 57a15bf8..77a17853 100644 --- a/src/people/widgetViews/__tests__/OrgHeader.spec.tsx +++ b/src/people/widgetViews/__tests__/OrgHeader.spec.tsx @@ -1,26 +1,73 @@ import React from 'react'; -import { render, fireEvent, screen } from '@testing-library/react'; +import { render, fireEvent, screen, waitFor } from '@testing-library/react'; import '@testing-library/jest-dom'; import { OrgHeader } from 'pages/tickets/org/orgHeader'; +const mockOnChangeLanguage = jest.fn(); +const selectedWidget = 'wanted'; describe('OrgHeader Component', () => { it('renders the component correctly', () => { - render(); + render( + + ); expect(screen.getByText('Post a Bounty')).toBeInTheDocument(); - expect(screen.getByLabelText('Status')).toBeInTheDocument(); - expect(screen.getByLabelText('Skill')).toBeInTheDocument(); + expect(screen.getByText('Status')).toBeInTheDocument(); + expect(screen.getByText('Skill')).toBeInTheDocument(); expect(screen.getByPlaceholderText('Search')).toBeInTheDocument(); expect(screen.getByText(/Bounties/i)).toBeInTheDocument(); }); it('opens the PostModal on "Post a Bounty" button click', async () => { - render(); + render( + + ); fireEvent.click(screen.getByText('Post a Bounty')); + // You can add further assertions here to check the modal is open }); it('displays the correct number of bounties', () => { - render(); + render( + + ); expect(screen.getByText('284')).toBeInTheDocument(); expect(screen.getByText('Bounties')).toBeInTheDocument(); }); + + it('toggles the SkillFilter on "Skill" dropdown button click', async () => { + render( + + ); + fireEvent.click(screen.getByTestId('skillDropdown')); + await waitFor(() => { + expect(screen.getByTestId('skill-filter')).toBeInTheDocument(); + }); + }); }); diff --git a/src/store/main.ts b/src/store/main.ts index 2c70e876..c944b4c1 100644 --- a/src/store/main.ts +++ b/src/store/main.ts @@ -1074,10 +1074,28 @@ export class MainStore { } } - async getOrganizationBounties(uuid: string, queryParams?: any): Promise { - queryParams = { ...queryParams, search: uiStore.searchText }; + async getOrganizationBounties(uuid: string, params?: QueryParams): Promise { + const queryParams: QueryParams = { + limit: 20, + sortBy: 'created', + search: uiStore.searchText ?? '', + page: 1, + resetPage: false, + ...params + }; + if (queryParams) { + this.getWantedsPrevParams = queryParams; + } + + // if we don't pass the params, we should use previous params for invalidate query + const query2 = this.appendQueryParams( + `organizations/bounties/${uuid}`, + 20, + params ? queryParams : this.getWantedsPrevParams + ); + try { - const ps2 = await api.get(`organizations/bounties/${uuid}`); + const ps2 = await api.get(query2); const ps3: any[] = []; if (ps2 && ps2.length) { From d7c4f6d8fcb37642d4865ec04ed1b7d411e33047 Mon Sep 17 00:00:00 2001 From: Tushar Vyas <89837102+Vayras@users.noreply.github.com> Date: Thu, 25 Jan 2024 01:15:18 +0530 Subject: [PATCH 02/15] api string fix --- src/config/host.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config/host.ts b/src/config/host.ts index 0a46e565..3bc2616d 100644 --- a/src/config/host.ts +++ b/src/config/host.ts @@ -2,7 +2,7 @@ const internalDockerHosts = ['localhost:13007', 'localhost:13000']; const externalDockerHosts = ['localhost:23007', 'localhost:23000']; export function getHost(): string { - const host = window.location.host.includes('localhost') ? 'localhost:5002' : `api.${window.location.host}`; + const host = window.location.host.includes('localhost') ? 'localhost:5002' : `${window.location.host}`; return host; } From 3d38b233c46a34ed80c0a29b7e45b9f614a7d0cc Mon Sep 17 00:00:00 2001 From: Tushar Vyas <89837102+Vayras@users.noreply.github.com> Date: Thu, 25 Jan 2024 01:16:33 +0530 Subject: [PATCH 03/15] merge confilict fix --- src/config/host.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config/host.ts b/src/config/host.ts index 3bc2616d..51a0f319 100644 --- a/src/config/host.ts +++ b/src/config/host.ts @@ -2,7 +2,7 @@ const internalDockerHosts = ['localhost:13007', 'localhost:13000']; const externalDockerHosts = ['localhost:23007', 'localhost:23000']; export function getHost(): string { - const host = window.location.host.includes('localhost') ? 'localhost:5002' : `${window.location.host}`; + const host = window.location.host.includes('localhost') ? 'localhost:5002' : window.location.host; return host; } From 713e173cd194e6bfe6ba86b134734437573e7ca8 Mon Sep 17 00:00:00 2001 From: Tushar Vyas <89837102+Vayras@users.noreply.github.com> Date: Fri, 26 Jan 2024 16:51:08 +0530 Subject: [PATCH 04/15] Test fix workflow --- src/config/ModeDispatcher.tsx | 2 +- src/config/host.ts | 2 +- src/pages/tickets/org/OrgTickets.tsx | 2 +- src/pages/tickets/org/orgHeader/index.tsx | 2 +- src/store/main.ts | 54 ++++++++++++++++++++++- 5 files changed, 57 insertions(+), 5 deletions(-) diff --git a/src/config/ModeDispatcher.tsx b/src/config/ModeDispatcher.tsx index a641b88c..d9a9c571 100644 --- a/src/config/ModeDispatcher.tsx +++ b/src/config/ModeDispatcher.tsx @@ -7,7 +7,7 @@ export enum AppMode { } const hosts: { [k: string]: AppMode } = { - 'localhost:3000': AppMode.TRIBES, + 'localhost:3000': AppMode.COMMUNITY, 'localhost:13000': AppMode.TRIBES, 'localhost:23000': AppMode.TRIBES, 'tribes.sphinx.chat': AppMode.TRIBES, diff --git a/src/config/host.ts b/src/config/host.ts index 51a0f319..d1b634bd 100644 --- a/src/config/host.ts +++ b/src/config/host.ts @@ -3,7 +3,7 @@ const externalDockerHosts = ['localhost:23007', 'localhost:23000']; export function getHost(): string { const host = window.location.host.includes('localhost') ? 'localhost:5002' : window.location.host; - return host; + return "people-test.sphinx.chat"; } export function getHostIncludingDockerHosts() { diff --git a/src/pages/tickets/org/OrgTickets.tsx b/src/pages/tickets/org/OrgTickets.tsx index 72c98eb7..59b9a585 100644 --- a/src/pages/tickets/org/OrgTickets.tsx +++ b/src/pages/tickets/org/OrgTickets.tsx @@ -34,7 +34,7 @@ function OrgBodyComponent() { await main.getBadgeList(); await main.getPeople(); if (uuid) { - await main.getOrganizationBounties(uuid, { + await main.getLanguageOrganizationBounties(uuid, { page: 1, resetPage: true, languages: languageString diff --git a/src/pages/tickets/org/orgHeader/index.tsx b/src/pages/tickets/org/orgHeader/index.tsx index a83cdf4c..9273f87b 100644 --- a/src/pages/tickets/org/orgHeader/index.tsx +++ b/src/pages/tickets/org/orgHeader/index.tsx @@ -174,7 +174,7 @@ const SecondaryText = styled.p` line-height: normal; `; const Img = styled.img` - padding-bottom: 10px; + padding-bottom: 20px; `; const SkillFilter = styled.div` diff --git a/src/store/main.ts b/src/store/main.ts index c944b4c1..23ef18d2 100644 --- a/src/store/main.ts +++ b/src/store/main.ts @@ -1074,7 +1074,7 @@ export class MainStore { } } - async getOrganizationBounties(uuid: string, params?: QueryParams): Promise { + async getLanguageOrganizationBounties(uuid: string, params?: QueryParams): Promise { const queryParams: QueryParams = { limit: 20, sortBy: 'created', @@ -1144,6 +1144,58 @@ export class MainStore { } } + async getOrganizationBounties(uuid: string, queryParams?: any): Promise { + queryParams = { ...queryParams, search: uiStore.searchText }; + try { + const ps2 = await api.get(`organizations/bounties/${uuid}`); + const ps3: any[] = []; + + if (ps2 && ps2.length) { + for (let i = 0; i < ps2.length; i++) { + const bounty = { ...ps2[i].bounty }; + let assignee; + let organization; + const owner = { ...ps2[i].owner }; + + if (bounty.assignee) { + assignee = { ...ps2[i].assignee }; + } + + if (bounty.org_uuid) { + organization = { ...ps2[i].organization }; + } + + ps3.push({ + body: { ...bounty, assignee: assignee || '' }, + person: { ...owner, wanteds: [] } || { wanteds: [] }, + organization: { ...organization } + }); + } + } + + // for search always reset page + if (queryParams && queryParams.resetPage) { + this.setPeopleBounties(ps3); + uiStore.setPeopleBountiesPageNumber(1); + } else { + // all other cases, merge + const wanteds = this.doPageListMerger( + this.peopleBounties, + ps3, + (n: any) => uiStore.setPeopleBountiesPageNumber(n), + queryParams, + 'wanted' + ); + + this.setPeopleBounties(wanteds); + } + return ps3; + } catch (e) { + console.log('fetch failed getOrganizationBounties: ', e); + return []; + } + } + async getBountyCount(personKey: string, tabType: string): Promise { try { const count = await api.get(`gobounties/count/${personKey}/${tabType}`); From 62f97ad47bbcfeabf188dc43ce094d23f4d1ea18 Mon Sep 17 00:00:00 2001 From: Tushar Vyas <89837102+Vayras@users.noreply.github.com> Date: Fri, 26 Jan 2024 16:57:32 +0530 Subject: [PATCH 05/15] merge resolve fix --- README.md | 52 ++++++++++++++++++++++++++++++++++++++-------- src/config/host.ts | 2 +- 2 files changed, 44 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index c749fc22..c679f53d 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,51 @@ -# build +# Sphinx Tribes 🌐 -**npm run build** +![Tribes](https://github.com/stakwork/sphinx-tribes/raw/master/img/sphinx-tribes.png) -### docker build +Welcome to **sphinx-tribes** - the decentralized message broker designed for public groups in Sphinx. Empowering users to run their own **sphinx-tribes** server, this platform seamlessly routes group messages for various applications such as **sphinx-relay** nodes, apps, websites, or IoT devices. -docker build -t sphinx-tribes-frontend . +## How it Works 🚀 -### docker publish +**sphinx-tribes** operates as an MQTT broker that any node can subscribe to. Message topics always consist of two parts: `{receiverPubKey}/{groupUUID}`. Only the group owner has the privilege to publish messages, and all messages from group members are required to be submitted to the owner as a Lightning keysend payment. The group `uuid` is essentially a timestamp signed by the owner. -docker tag sphinx-tribes-frontend sphinxlightning/sphinx-tribes-frontend:0.1.3 +![Tribes](https://github.com/stakwork/sphinx-tribes/raw/master/img/tribes.jpg) -docker push sphinxlightning/sphinx-tribes-frontend:0.1.3 +## Authentication 🔒 -docker tag sphinx-tribes-frontend sphinxlightning/sphinx-tribes-frontend:latest +The authentication process is seamlessly handled by [sphinx-auth](https://github.com/stakwork/sphinx-auth). -docker push sphinxlightning/sphinx-tribes-frontend:latest \ No newline at end of file +## Running Against Sphinx-Stack 🏃 + +To run the **tribes** frontend locally, utilize the following ports: + +- Tribes: `yarn start:tribes:docker` (localhost:23000) +- People: `yarn start:people:docker` (localhost:23007) + +## Running Frontend Against people.sphinx.chat Locally 🌐 + +If you wish to run only the frontend, follow these steps: + +1. Modify line 10 in `src/config/ModeDispatcher.tsx`: + - Change `'localhost:3000': AppMode.TRIBES` to `'localhost:3000': AppMode.COMMUNITY` + +2. Modify line 27 in `src/config/ModeDispatcher.tsx`: + - Change `return hosts[host] || AppMode.TRIBES;` to `return hosts[host] || AppMode.COMMUNITY;` + +3. Modify line 6 in `src/config/host.ts`: + - Change `return host;` to `return 'people-test.sphinx.chat';` + +4. Open the terminal. Locate your folder and then run: + +- `yarn install` to install the dependencies +- `yarn start` to run the frontend locally + +## Contributing Guidelines 🤝 + +All code contributions, including those of people having commit access, must go through a pull request and be approved by a core developer before being merged. This is to ensure a proper review of all the code. + +We truly ❤️ pull requests! If you wish to help, you can learn more about how you can contribute to this project in the [contribution guide](CONTRIBUTING.md). +## Community and Support 💬 + +Join our community on [Forum/Chat](https://people.sphinx.chat) to connect with other users and get support. + +Feel free to explore the potential of **sphinx-tribes** and contribute to its vibrant ecosystem! 🌟 \ No newline at end of file diff --git a/src/config/host.ts b/src/config/host.ts index d1b634bd..51a0f319 100644 --- a/src/config/host.ts +++ b/src/config/host.ts @@ -3,7 +3,7 @@ const externalDockerHosts = ['localhost:23007', 'localhost:23000']; export function getHost(): string { const host = window.location.host.includes('localhost') ? 'localhost:5002' : window.location.host; - return "people-test.sphinx.chat"; + return host; } export function getHostIncludingDockerHosts() { From dd4c6e6ac3c44d4c4c2265ff4ea96619b68b26b3 Mon Sep 17 00:00:00 2001 From: Tushar Vyas <89837102+Vayras@users.noreply.github.com> Date: Fri, 26 Jan 2024 17:01:10 +0530 Subject: [PATCH 06/15] prettier fix --- src/store/main.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/store/main.ts b/src/store/main.ts index 23ef18d2..a779f33b 100644 --- a/src/store/main.ts +++ b/src/store/main.ts @@ -1074,7 +1074,10 @@ export class MainStore { } } - async getLanguageOrganizationBounties(uuid: string, params?: QueryParams): Promise { + async getLanguageOrganizationBounties( + uuid: string, + params?: QueryParams + ): Promise { const queryParams: QueryParams = { limit: 20, sortBy: 'created', From f4bd5c4fcb73f2b55c7c2e379aaea2d7be097c3c Mon Sep 17 00:00:00 2001 From: Tushar Vyas <89837102+Vayras@users.noreply.github.com> Date: Fri, 26 Jan 2024 17:06:36 +0530 Subject: [PATCH 07/15] merge resolve --- src/pages/tickets/org/OrgTickets.tsx | 2 +- src/store/main.ts | 33 +++++++++++++++++++--------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/src/pages/tickets/org/OrgTickets.tsx b/src/pages/tickets/org/OrgTickets.tsx index 59b9a585..42aed7fb 100644 --- a/src/pages/tickets/org/OrgTickets.tsx +++ b/src/pages/tickets/org/OrgTickets.tsx @@ -34,7 +34,7 @@ function OrgBodyComponent() { await main.getBadgeList(); await main.getPeople(); if (uuid) { - await main.getLanguageOrganizationBounties(uuid, { + await main.getSpecificOrganizationBounties(uuid, { page: 1, resetPage: true, languages: languageString diff --git a/src/store/main.ts b/src/store/main.ts index a779f33b..66c1f2ac 100644 --- a/src/store/main.ts +++ b/src/store/main.ts @@ -184,6 +184,7 @@ export interface QueryParams { search?: string; resetPage?: boolean; languages?: string; + org_uuid?: string; } export interface ClaimOnLiquid { @@ -291,6 +292,19 @@ export const defaultBountyStatus: BountyStatus = { Paid: false }; +export interface OrgBountyStatus { + Open: boolean; + Assigned: boolean; + Paid: boolean; + Completed: boolean; +} + +export const defaultOrgBountyStatus: OrgBountyStatus = { + Open: false, + Assigned: false, + Paid: false, + Completed: false +}; export class MainStore { [x: string]: any; tribes: Tribe[] = []; @@ -1074,29 +1088,28 @@ export class MainStore { } } - async getLanguageOrganizationBounties( - uuid: string, - params?: QueryParams - ): Promise { + getWantedsSpecOrgPrevParams?: QueryParams = {}; + async getSpecificOrganizationBounties(uuid: string, params?: any): Promise { const queryParams: QueryParams = { - limit: 20, + limit: queryLimit, sortBy: 'created', search: uiStore.searchText ?? '', page: 1, resetPage: false, ...params }; - if (queryParams) { - this.getWantedsPrevParams = queryParams; + + if (params) { + // save previous params + this.getWantedsSpecOrgPrevParams = queryParams; } // if we don't pass the params, we should use previous params for invalidate query const query2 = this.appendQueryParams( `organizations/bounties/${uuid}`, - 20, - params ? queryParams : this.getWantedsPrevParams + queryLimit, + params ? queryParams : this.getWantedsOrgPrevParams ); - try { const ps2 = await api.get(query2); const ps3: any[] = []; From 513fc2a1ba13c5e75fe8ec647e46d860be334fc8 Mon Sep 17 00:00:00 2001 From: Tushar Vyas <89837102+Vayras@users.noreply.github.com> Date: Fri, 26 Jan 2024 18:12:41 +0530 Subject: [PATCH 08/15] Update index.tsx --- src/pages/tickets/org/orgHeader/index.tsx | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/pages/tickets/org/orgHeader/index.tsx b/src/pages/tickets/org/orgHeader/index.tsx index acec6042..aacfdc55 100644 --- a/src/pages/tickets/org/orgHeader/index.tsx +++ b/src/pages/tickets/org/orgHeader/index.tsx @@ -1,12 +1,9 @@ - import React, { useState, useEffect, useRef } from 'react'; import styled from 'styled-components'; import { EuiCheckboxGroup, EuiPopover, EuiText } from '@elastic/eui'; import MaterialIcon from '@material/react-material-icon'; import { PostModal } from 'people/widgetViews/postBounty/PostModal'; -import { EuiCheckboxGroup } from '@elastic/eui'; import { GetValue, coding_languages } from 'people/utils/languageLabelStyle'; -import { BountyHeaderProps } from 'people/interfaces'; import { colors } from 'config'; import { OrgBountyHeaderProps } from '../../../../people/interfaces'; import { useStores } from '../../../../store'; @@ -72,13 +69,6 @@ const FiltersRight = styled.span` width: 1366px; `; -const StatusContainer = styled.span` - padding: 7px 0px; - align-items: center; - display: flex; - position: relative; -`; - const SkillContainer = styled.span` padding: 7px 0px; align-items: center; @@ -108,7 +98,6 @@ const Button = styled.button` letter-spacing: 0.14px; `; -const Label = styled.p` const UrlButton = styled.button` border-radius: 4px; margin-right: auto; @@ -422,7 +411,6 @@ const StatusContainer = styled.div` `; const Status = ['Open', 'Assigned', 'Completed', 'Paid']; -const color = colors['light']; export const OrgHeader = ({ onChangeLanguage, checkboxIdToSelectedMapLanguage, From 58027dd9153ff9d86317b3c0d44bfe19645decb9 Mon Sep 17 00:00:00 2001 From: Tushar Vyas <89837102+Vayras@users.noreply.github.com> Date: Fri, 26 Jan 2024 18:21:57 +0530 Subject: [PATCH 09/15] merge fixed --- src/config/host.ts | 2 +- src/pages/tickets/org/OrgTickets.tsx | 6 +++--- .../{dropwDownIcon.svg => dropDownIcon.svg} | 0 src/pages/tickets/org/orgHeader/index.tsx | 16 ++++------------ src/people/interfaces.ts | 2 ++ 5 files changed, 10 insertions(+), 16 deletions(-) rename src/pages/tickets/org/orgHeader/Icons/{dropwDownIcon.svg => dropDownIcon.svg} (100%) diff --git a/src/config/host.ts b/src/config/host.ts index 51a0f319..20c2c93a 100644 --- a/src/config/host.ts +++ b/src/config/host.ts @@ -3,7 +3,7 @@ const externalDockerHosts = ['localhost:23007', 'localhost:23000']; export function getHost(): string { const host = window.location.host.includes('localhost') ? 'localhost:5002' : window.location.host; - return host; + return 'people-test.sphinx.chat'; } export function getHostIncludingDockerHosts() { diff --git a/src/pages/tickets/org/OrgTickets.tsx b/src/pages/tickets/org/OrgTickets.tsx index f49a1d1d..53287a91 100644 --- a/src/pages/tickets/org/OrgTickets.tsx +++ b/src/pages/tickets/org/OrgTickets.tsx @@ -22,7 +22,6 @@ function OrgBodyComponent() { const [scrollValue, setScrollValue] = useState(false); const [checkboxIdToSelectedMap, setCheckboxIdToSelectedMap] = useState(defaultOrgBountyStatus); const [checkboxIdToSelectedMapLanguage, setCheckboxIdToSelectedMapLanguage] = useState({}); - const [languageString, setLanguageString] = useState(''); const { uuid } = useParams<{ uuid: string; bountyId: string }>(); const [languageString, setLanguageString] = useState(''); const [organizationUrls, setOrganizationUrls] = useState({}); @@ -167,12 +166,13 @@ function OrgBodyComponent() { }} > <>
{ const { main } = useStores(); const [isPostBountyModalOpen, setIsPostBountyModalOpen] = useState(false); - const [filterClick, setFilterClick] = useState(false); + const [filterClick, setFilterClick] = useState(false); const [isStatusPopoverOpen, setIsStatusPopoverOpen] = useState(false); const onButtonClick = async () => { setIsStatusPopoverOpen((isPopoverOpen: any) => !isPopoverOpen); @@ -455,7 +454,7 @@ export const OrgHeader = ({ languageString }); } - }, [org_uuid, checkboxIdToSelectedMap]); + }, [org_uuid, checkboxIdToSelectedMap, main, languageString]); const handleClick = () => { setFilterClick(!filterClick); @@ -508,13 +507,6 @@ export const OrgHeader = ({ - - Status - - {' '} - - - diff --git a/src/people/interfaces.ts b/src/people/interfaces.ts index 876735ad..5bdfeb8c 100644 --- a/src/people/interfaces.ts +++ b/src/people/interfaces.ts @@ -424,7 +424,9 @@ export interface BountyHeaderProps { export interface OrgBountyHeaderProps { onChangeStatus: (number) => void; + onChangeLanguage: (number) => void; checkboxIdToSelectedMap?: any; + checkboxIdToSelectedMapLanguage: any; languageString?: string; org_uuid?: string; } From 57ab68841c4cdbe847fa394fe28fd1dd6698c438 Mon Sep 17 00:00:00 2001 From: Tushar Vyas <89837102+Vayras@users.noreply.github.com> Date: Fri, 26 Jan 2024 18:23:47 +0530 Subject: [PATCH 10/15] style fix --- 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 4a9a21c0..6ccd4aa2 100644 --- a/src/pages/tickets/org/orgHeader/index.tsx +++ b/src/pages/tickets/org/orgHeader/index.tsx @@ -199,7 +199,7 @@ const SecondaryText = styled.p` line-height: normal; `; const Img = styled.img` - padding-bottom: 20px; + padding-bottom: 10px; `; const SkillFilter = styled.div` From 9647a7bc1833942d2b781b4bf3744af5fc9fe9d8 Mon Sep 17 00:00:00 2001 From: Tushar Vyas <89837102+Vayras@users.noreply.github.com> Date: Fri, 26 Jan 2024 18:27:22 +0530 Subject: [PATCH 11/15] test fix --- src/people/interfaces.ts | 2 +- src/people/widgetViews/__tests__/OrgHeader.spec.tsx | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/people/interfaces.ts b/src/people/interfaces.ts index 5bdfeb8c..dfe4c0a2 100644 --- a/src/people/interfaces.ts +++ b/src/people/interfaces.ts @@ -426,7 +426,7 @@ export interface OrgBountyHeaderProps { onChangeStatus: (number) => void; onChangeLanguage: (number) => void; checkboxIdToSelectedMap?: any; - checkboxIdToSelectedMapLanguage: any; + checkboxIdToSelectedMapLanguage?: any; languageString?: string; org_uuid?: string; } diff --git a/src/people/widgetViews/__tests__/OrgHeader.spec.tsx b/src/people/widgetViews/__tests__/OrgHeader.spec.tsx index 6931ba58..afcd5491 100644 --- a/src/people/widgetViews/__tests__/OrgHeader.spec.tsx +++ b/src/people/widgetViews/__tests__/OrgHeader.spec.tsx @@ -15,14 +15,12 @@ const MockProps: OrgBountyHeaderProps = { languageString: '', org_uuid: 'clf6qmo4nncmf23du7ng', onChangeStatus: jest.fn(), + onChangeLanguage: jest.fn(), organizationUrls: { github: 'https://github.com/stakwork/sphinx-tribes', website: 'https://ecurrencyhodler.com/' } }; - -const mockOnChangeLanguage = jest.fn(); -const selectedWidget = 'wanted'; describe('OrgHeader Component', () => { beforeEach(() => { jest.spyOn(mainStore, 'getSpecificOrganizationBounties').mockReset(); From c7cdd5804d2e1f64efc714dd7540d5797245ca7e Mon Sep 17 00:00:00 2001 From: Tushar Vyas <89837102+Vayras@users.noreply.github.com> Date: Fri, 26 Jan 2024 20:19:01 +0530 Subject: [PATCH 12/15] test fix' --- src/people/widgetViews/__tests__/OrgHeader.spec.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/people/widgetViews/__tests__/OrgHeader.spec.tsx b/src/people/widgetViews/__tests__/OrgHeader.spec.tsx index afcd5491..aa8513b7 100644 --- a/src/people/widgetViews/__tests__/OrgHeader.spec.tsx +++ b/src/people/widgetViews/__tests__/OrgHeader.spec.tsx @@ -34,7 +34,7 @@ describe('OrgHeader Component', () => { render(); expect(screen.getByText('Post a Bounty')).toBeInTheDocument(); expect(screen.getByText('Status')).toBeInTheDocument(); - expect(screen.getByLabelText('Skill')).toBeInTheDocument(); + expect(screen.getByText('Skill')).toBeInTheDocument(); expect(screen.getByPlaceholderText('Search')).toBeInTheDocument(); expect(screen.getByText(/Bounties/i)).toBeInTheDocument(); }); From c38542451f6a36ecf29561ed3e921d634b0bdf62 Mon Sep 17 00:00:00 2001 From: Tushar Vyas <89837102+Vayras@users.noreply.github.com> Date: Fri, 26 Jan 2024 22:34:39 +0530 Subject: [PATCH 13/15] Update ModeDispatcher.tsx --- src/config/ModeDispatcher.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config/ModeDispatcher.tsx b/src/config/ModeDispatcher.tsx index d9a9c571..a641b88c 100644 --- a/src/config/ModeDispatcher.tsx +++ b/src/config/ModeDispatcher.tsx @@ -7,7 +7,7 @@ export enum AppMode { } const hosts: { [k: string]: AppMode } = { - 'localhost:3000': AppMode.COMMUNITY, + 'localhost:3000': AppMode.TRIBES, 'localhost:13000': AppMode.TRIBES, 'localhost:23000': AppMode.TRIBES, 'tribes.sphinx.chat': AppMode.TRIBES, From c9817294e4911a5b224523c5bb10866d8aaae66d Mon Sep 17 00:00:00 2001 From: Tushar Vyas <89837102+Vayras@users.noreply.github.com> Date: Fri, 26 Jan 2024 22:35:06 +0530 Subject: [PATCH 14/15] Update host.ts --- src/config/host.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config/host.ts b/src/config/host.ts index 20c2c93a..51a0f319 100644 --- a/src/config/host.ts +++ b/src/config/host.ts @@ -3,7 +3,7 @@ const externalDockerHosts = ['localhost:23007', 'localhost:23000']; export function getHost(): string { const host = window.location.host.includes('localhost') ? 'localhost:5002' : window.location.host; - return 'people-test.sphinx.chat'; + return host; } export function getHostIncludingDockerHosts() { From 39f2b15c8e6f1ded700104d3e4d4ac4555587269 Mon Sep 17 00:00:00 2001 From: Tushar Vyas <89837102+Vayras@users.noreply.github.com> Date: Mon, 29 Jan 2024 00:02:18 +0530 Subject: [PATCH 15/15] fix alignment --- src/pages/tickets/org/orgHeader/index.tsx | 116 ++++++++++++---------- 1 file changed, 61 insertions(+), 55 deletions(-) diff --git a/src/pages/tickets/org/orgHeader/index.tsx b/src/pages/tickets/org/orgHeader/index.tsx index 6ccd4aa2..e8883144 100644 --- a/src/pages/tickets/org/orgHeader/index.tsx +++ b/src/pages/tickets/org/orgHeader/index.tsx @@ -70,7 +70,7 @@ const FiltersRight = styled.span` `; const SkillContainer = styled.span` - padding: 7px 0px; + padding: 10px 0px; align-items: center; display: flex; position: relative; @@ -160,7 +160,7 @@ const SearchBar = styled.input` `; const SoryByContainer = styled.span` - padding: 7px 0px; + padding: 10px 0px; display: flex; justify-content: center; align-items: center; @@ -346,6 +346,8 @@ const EuiPopOverCheckbox = styled.div` } `; +const NewStatusContainer = styled.div``; + const StatusContainer = styled.div` width: 70px; height: 48px; @@ -507,64 +509,68 @@ export const OrgHeader = ({ - - - Status - -
- + + -
- - } - panelStyle={{ - border: 'none', - boxShadow: `0px 1px 20px ${color.black90}`, - background: `${color.pureWhite}`, - borderRadius: '0px 0px 6px 6px', - maxWidth: '140px', - minHeight: '160px', - marginTop: '0px', - marginLeft: '20px' - }} - isOpen={isStatusPopoverOpen} - closePopover={closeStatusPopover} - panelClassName="yourClassNameHere" - panelPaddingSize="none" - anchorPosition="downLeft" - > -
+ Status + +
+ +
+ + } + panelStyle={{ + border: 'none', + boxShadow: `0px 1px 20px ${color.black90}`, + background: `${color.pureWhite}`, + borderRadius: '0px 0px 6px 6px', + maxWidth: '140px', + minHeight: '160px', + marginTop: '0px', + marginLeft: '20px' }} + isOpen={isStatusPopoverOpen} + closePopover={closeStatusPopover} + panelClassName="yourClassNameHere" + panelPaddingSize="none" + anchorPosition="downLeft" > - - ({ - label: `${status}`, - id: status - }))} - idToSelectedMap={checkboxIdToSelectedMap} - onChange={(id: any) => { - onChangeStatus(id); - }} - /> - -
-
+
+ + ({ + label: `${status}`, + id: status + }))} + idToSelectedMap={checkboxIdToSelectedMap} + onChange={(id: any) => { + onChangeStatus(id); + }} + /> + +
+
+ Skill