Skip to content

Commit

Permalink
Merge pull request #497 from stakwork/feat/budget_redesign
Browse files Browse the repository at this point in the history
Budget Redesign
  • Loading branch information
elraphty authored Apr 17, 2024
2 parents 98bac39 + 0e88d9f commit c1bbcec
Show file tree
Hide file tree
Showing 12 changed files with 302 additions and 121 deletions.
10 changes: 5 additions & 5 deletions deploy/prod/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ services:
- /var/run/docker.sock:/var/run/docker.sock
- /home/ec2-user/sphinx-deploy/traefik.yaml:/etc/traefik/traefik.yaml
- /home/ec2-user/letsencrypt:/letsencrypt
environment:
environment:
- AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY
- AWS_REGION=$AWS_REGION
Expand All @@ -44,7 +44,7 @@ services:
- "traefik.http.routers.auth.tls.certresolver=myresolver"
- "traefik.http.routers.auth.entrypoints=websecure"
restart: on-failure
environment:
environment:
- JWT_KEY=$JWT_KEY
- CLIENT_KEYS=$CLIENT_KEYS
- OAUTH_TIMEOUT=$OAUTH_TIMEOUT
Expand All @@ -64,7 +64,7 @@ services:
- "traefik.http.routers.tribes.tls.certresolver=myresolver"
- "traefik.http.routers.tribes.entrypoints=websecure"
restart: on-failure
environment:
environment:
- DATABASE_URL=$DATABASE_URL
- PODCAST_INDEX_SECRET=$PODCAST_INDEX_SECRET
- PODCAST_INDEX_KEY=$PODCAST_INDEX_KEY
Expand All @@ -73,7 +73,7 @@ services:
- ALERT_SECRET=$ALERT_SECRET
- ALERT_TRIBE_UUID=$ALERT_TRIBE_UUID
- ALERT_BOT_ID=$ALERT_BOT_ID
- ALERT_URL=$ALERT_URL
- ALERT_URL=$ALERT_URL
- RELAY_URL=$RELAY_URL
- RELAY_AUTH_KEY=$RELAY_AUTH_KEY
- RELAY_URL_BACKUP=$RELAY_URL_BACKUP
Expand All @@ -99,7 +99,7 @@ services:
- reverse-proxy
labels:
- "traefik.enable=true"
- "traefik.http.routers.tribes-frontend.rule=(Host(`tribes.sphinx.chat`) || Host(`people.sphinx.chat`) || Host(`community.sphinx.chat`)|| Host(`bounties.sphinx.chat`)) && (Path(`/`) || PathPrefix(`/static`) || Path(`/manifest.json`) || Path(`/favicon.ico`) || Path(`/logo192.png`) || PathPrefix(`/t/`) || Path(`/t`) || PathPrefix(`/p/`) || Path(`/p`) || Path(`/tickets`) || Path(`/bounties`) || Path(`/bounty`) || PathPrefix(`/bounty/`) || Path(`/leaderboard`) || PathPrefix(`/org/`) || Path(`/admin`) || PathPrefix(`/b/`) || Path(`/b`))"
- "traefik.http.routers.tribes-frontend.rule=(Host(`tribes.sphinx.chat`) || Host(`people.sphinx.chat`) || Host(`community.sphinx.chat`)|| Host(`bounties.sphinx.chat`)) && (Path(`/`) || PathPrefix(`/static`) || Path(`/manifest.json`) || Path(`/favicon.ico`) || Path(`/logo192.png`) || PathPrefix(`/t/`) || Path(`/t`) || PathPrefix(`/p/`) || Path(`/p`) || Path(`/tickets`) || Path(`/bounties`) || Path(`/bounty`) || PathPrefix(`/bounty/`) || Path(`/leaderboard`) || PathPrefix(`/workspace/`) || Path(`/admin`) || PathPrefix(`/b/`) || Path(`/b`))"
- "traefik.http.routers.tribes-frontend.priority=2"
- "traefik.http.services.tribes-frontend.loadbalancer.server.port=80"
- "traefik.http.routers.tribes-frontend.tls=true"
Expand Down
2 changes: 1 addition & 1 deletion deploy/staging/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ services:
- reverse-proxy
labels:
- "traefik.enable=true"
- "traefik.http.routers.tribes-frontend.rule=(Host(`tribes-test.sphinx.chat`) || Host(`people-test.sphinx.chat`) || Host(`community-test.sphinx.chat`)) && (Path(`/`) || PathPrefix(`/static`) || Path(`/manifest.json`) || Path(`/favicon.ico`) || Path(`/logo192.png`) || PathPrefix(`/t/`) || Path(`/t`) || PathPrefix(`/p/`) || Path(`/p`) || Path(`/tickets`) || Path(`/bounties`) || Path(`/bounty`) || PathPrefix(`/bounty/`) || Path(`/leaderboard`) || PathPrefix(`/org/`) || Path(`/admin`) || PathPrefix(`/b/`) || Path(`/b`))"
- "traefik.http.routers.tribes-frontend.rule=(Host(`tribes-test.sphinx.chat`) || Host(`people-test.sphinx.chat`) || Host(`community-test.sphinx.chat`)) && (Path(`/`) || PathPrefix(`/static`) || Path(`/manifest.json`) || Path(`/favicon.ico`) || Path(`/logo192.png`) || PathPrefix(`/t/`) || Path(`/t`) || PathPrefix(`/p/`) || Path(`/p`) || Path(`/tickets`) || Path(`/bounties`) || Path(`/bounty`) || PathPrefix(`/bounty/`) || Path(`/leaderboard`) || PathPrefix(`/workspace/`) || Path(`/admin`) || PathPrefix(`/b/`) || Path(`/b`))"
- "traefik.http.routers.tribes-frontend.priority=2"
- "traefik.http.services.tribes-frontend.loadbalancer.server.port=80"
- "traefik.http.routers.tribes-frontend.tls=true"
Expand Down
2 changes: 1 addition & 1 deletion deploy/staging/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ services:
- reverse-proxy
labels:
- "traefik.enable=true"
- "traefik.http.routers.tribes-frontend.rule=(Host(`tribes-test.sphinx.chat`) || Host(`people-test.sphinx.chat`) || Host(`community-test.sphinx.chat`)) && (Path(`/`) || PathPrefix(`/static`) || Path(`/manifest.json`) || Path(`/favicon.ico`) || Path(`/logo192.png`) || PathPrefix(`/t/`) || Path(`/t`) || PathPrefix(`/p/`) || Path(`/p`) || Path(`/tickets`) || Path(`/bounties`) || Path(`/bounty`) || PathPrefix(`/bounty/`) || Path(`/leaderboard`) || PathPrefix(`/org/`) || Path(`/admin`) || PathPrefix(`/b/`) || Path(`/b`))"
- "traefik.http.routers.tribes-frontend.rule=(Host(`tribes-test.sphinx.chat`) || Host(`people-test.sphinx.chat`) || Host(`community-test.sphinx.chat`)) && (Path(`/`) || PathPrefix(`/static`) || Path(`/manifest.json`) || Path(`/favicon.ico`) || Path(`/logo192.png`) || PathPrefix(`/t/`) || Path(`/t`) || PathPrefix(`/p/`) || Path(`/p`) || Path(`/tickets`) || Path(`/bounties`) || Path(`/bounty`) || PathPrefix(`/bounty/`) || Path(`/leaderboard`) || PathPrefix(`/workspace/`) || Path(`/admin`) || PathPrefix(`/b/`) || Path(`/b`))"
- "traefik.http.routers.tribes-frontend.priority=2"
- "traefik.http.services.tribes-frontend.loadbalancer.server.port=80"
- "traefik.http.routers.tribes-frontend.tls=true"
Expand Down
37 changes: 31 additions & 6 deletions src/pages/tickets/Tickets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,17 @@ import WidgetSwitchViewer from 'people/widgetViews/WidgetSwitchViewer';
import React, { useCallback, useEffect, useState } from 'react';
import { useHistory } from 'react-router';
import { queryLimit, defaultBountyStatus } from 'store/main';
import { useLocation } from 'react-router-dom';
import { colors } from '../../config/colors';
import { useIsMobile } from '../../hooks';
import { useStores } from '../../store';
import { Body, Backdrop } from './style';

function useQuery() {
const { search } = useLocation();
return React.useMemo(() => new URLSearchParams(search), [search]);
}

// avoid hook within callback warning by renaming hooks
function BodyComponent() {
const { main, ui } = useStores();
Expand All @@ -30,6 +36,30 @@ function BodyComponent() {
const history = useHistory();
const isMobile = useIsMobile();

const searchParams = useQuery();

useEffect(() => {
const status = searchParams.get('status');
if (status === 'completed') {
setCheckboxIdToSelectedMap({
...defaultBountyStatus,
Open: false,
Completed: true
});
} else if (status === 'assigned') {
setCheckboxIdToSelectedMap({
...defaultBountyStatus,
Open: false,
Assigned: true
});
} else if (status === 'open') {
setCheckboxIdToSelectedMap({
...defaultBountyStatus,
Open: true
});
}
}, [searchParams, loading]);

useEffect(() => {
(async () => {
await main.getOpenGithubIssues();
Expand All @@ -43,12 +73,7 @@ function BodyComponent() {
});
setLoading(false);
})();
}, [main, checkboxIdToSelectedMap, languageString]);

useEffect(() => {
setCheckboxIdToSelectedMap({ ...defaultBountyStatus });
main.setBountiesStatus({ ...defaultBountyStatus });
}, [loading]);
}, [main, checkboxIdToSelectedMap, languageString, searchParams]);

useEffect(() => {
if (ui.meInfo) {
Expand Down
15 changes: 15 additions & 0 deletions src/pages/tickets/__tests__/Tickets.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,21 @@ jest.mock('remark-gfm', () => {});
// eslint-disable-next-line @typescript-eslint/no-empty-function
jest.mock('rehype-raw', () => {});

const mockPush = jest.fn();
const mockGoBack = jest.fn();
jest.mock('react-router-dom', () => ({
...jest.requireActual('react-router-dom'),
useHistory: () => ({
push: mockPush,
goBack: mockGoBack
}),
useLocation: () => ({
pathname: '/bounties',
search: '',
state: {}
})
}));

jest.mock('../../../store', () => ({
useStores: jest.fn(() => ({
main: {
Expand Down
2 changes: 1 addition & 1 deletion src/people/utils/languageLabelStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export const coding_languages = [
'Other'
] as const;

export const status = ['Open', 'Assigned', 'Paid'];
export const status = ['Open', 'Assigned', 'Completed', 'Paid'];

export const GetValue = <Item = string>(arr: any): Array<{ id: Item; label: Item; value: Item }> =>
arr.map((val: Item) => ({
Expand Down
2 changes: 2 additions & 0 deletions src/people/widgetViews/BountyHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ const BountyHeader = ({
const [counts, setCounts] = useState({
open: 0,
assigned: 0,
completed: 0,
paid: 0
});

Expand All @@ -367,6 +368,7 @@ const BountyHeader = ({
setCounts({
open: response.open || 0,
assigned: response.assigned || 0,
completed: response.completed || 0,
paid: response.paid || 0
});
} catch (error) {
Expand Down
Loading

0 comments on commit c1bbcec

Please sign in to comment.