Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/org bounties display #1065

Merged
merged 2 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion frontend/app/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { MainLayout } from './MainLayout';
import { Modals } from './Modals';
import { People } from './people';
import { TicketsPage } from './tickets';
import { OrgTicketsPage } from './tickets/org';
import { LeaderboardPage } from './leaderboard';

const modeDispatchPages: Record<AppMode, () => React.ReactElement> = {
Expand All @@ -40,7 +41,7 @@ const modeDispatchPages: Record<AppMode, () => React.ReactElement> = {
<TicketsPage />
</Route>
<Route path="/org/bounties/:uuid">
<TicketsPage />
<OrgTicketsPage />
</Route>
<Route path="/leaderboard">
<LeaderboardPage />
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/src/pages/tickets/TicketModalPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const TicketModalPage = observer(({ setConnectPerson }: Props) => {
const [isDeleted, setisDeleted] = useState(false);

const isMobile = useIsMobile();
const { uuid } = useParams<{ uuid: string }>();

const search = useMemo(() => {
const s = new URLSearchParams(location.search);
Expand Down Expand Up @@ -79,7 +80,6 @@ export const TicketModalPage = observer(({ setConnectPerson }: Props) => {
const goBack = async () => {
setVisible(false);
setisDeleted(false);
await main.getPeopleBounties({ page: 1, resetPage: true });
history.goBack();
};

Expand Down
136 changes: 53 additions & 83 deletions frontend/app/src/pages/tickets/Tickets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,12 @@ import BountyHeader from 'people/widgetViews/BountyHeader';
import WidgetSwitchViewer from 'people/widgetViews/WidgetSwitchViewer';
import React, { useEffect, useState } from 'react';
import { useHistory } from 'react-router';
import { useLocation, useParams } from 'react-router-dom';
import styled from 'styled-components';
import { colors } from '../../config/colors';
import { useIsMobile } from '../../hooks';
import { useStores } from '../../store';
import { Body, Backdrop } from './style';

// avoid hook within callback warning by renaming hooks
const Body = styled.div`
flex: 1;
height: calc(100% - 105px);
width: 100%;
overflow: auto;
display: flex;
flex-direction: column;
`;

const Backdrop = styled.div`
position: fixed;
z-index: 1;
background: rgba(0, 0, 0, 70%);
top: 0;
bottom: 0;
left: 0;
right: 0;
`;

export const Spacer = styled.div`
display: flex;
min-height: 10px;
min-width: 100%;
height: 10px;
width: 100%;
`;

function BodyComponent() {
const { main, ui } = useStores();
Expand All @@ -47,27 +20,21 @@ function BodyComponent() {
const [scrollValue, setScrollValue] = useState<boolean>(false);
const [checkboxIdToSelectedMap, setCheckboxIdToSelectedMap] = useState({});
const [checkboxIdToSelectedMapLanguage, setCheckboxIdToSelectedMapLanguage] = useState({});
const { uuid } = useParams<{ uuid: string; bountyId: string }>();

const color = colors['light'];

const history = useHistory();
const isMobile = useIsMobile();
const location = useLocation();

useEffect(() => {
(async () => {
await main.getOpenGithubIssues();
await main.getBadgeList();
await main.getPeople();
if (uuid) {
await main.getOrganizationBounties(uuid, { page: 1, resetPage: true });
} else {
await main.getPeopleBounties({ page: 1, resetPage: true });
}
await main.getPeopleBounties({ page: 1, resetPage: true });
setLoading(false);
})();
}, [main, uuid]);
}, [main]);

useEffect(() => {
setCheckboxIdToSelectedMap({
Expand Down Expand Up @@ -129,7 +96,7 @@ function BodyComponent() {
/>
);

if (isMobile) {
if (!loading && isMobile) {
return (
<Body>
<div
Expand Down Expand Up @@ -169,65 +136,68 @@ function BodyComponent() {
</Body>
);
}

return (
<Body
onScroll={(e: any) => {
setScrollValue(e?.currentTarget?.scrollTop >= 20);
}}
style={{
background: color.grayish.G950,
height: 'calc(100% - 65px)'
}}
>
<div
!loading && (
<Body
onScroll={(e: any) => {
setScrollValue(e?.currentTarget?.scrollTop >= 20);
}}
style={{
minHeight: '32px'
background: color.grayish.G950,
height: 'calc(100% - 65px)'
}}
/>

<BountyHeader
selectedWidget={selectedWidget}
scrollValue={scrollValue}
onChangeStatus={onChangeStatus}
onChangeLanguage={onChangeLanguage}
checkboxIdToSelectedMap={checkboxIdToSelectedMap}
checkboxIdToSelectedMapLanguage={checkboxIdToSelectedMapLanguage}
/>

<>
>
<div
style={{
width: '100%',
display: 'flex',
flexWrap: 'wrap',
height: '100%',
justifyContent: 'flex-start',
alignItems: 'flex-start',
padding: '0px 20px 20px 20px'
minHeight: '32px'
}}
>
/>

<BountyHeader
selectedWidget={selectedWidget}
scrollValue={scrollValue}
onChangeStatus={onChangeStatus}
onChangeLanguage={onChangeLanguage}
checkboxIdToSelectedMap={checkboxIdToSelectedMap}
checkboxIdToSelectedMapLanguage={checkboxIdToSelectedMapLanguage}
/>

<>
<div
style={{
width: '100%',
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
height: '100%'
flexWrap: 'wrap',
height: '100%',
justifyContent: 'flex-start',
alignItems: 'flex-start',
padding: '0px 20px 20px 20px'
}}
>
<WidgetSwitchViewer
checkboxIdToSelectedMap={checkboxIdToSelectedMap}
checkboxIdToSelectedMapLanguage={checkboxIdToSelectedMapLanguage}
onPanelClick={onPanelClick}
fromBountyPage={true}
selectedWidget={selectedWidget}
loading={loading}
/>
<div
style={{
width: '100%',
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
height: '100%'
}}
>
<WidgetSwitchViewer
checkboxIdToSelectedMap={checkboxIdToSelectedMap}
checkboxIdToSelectedMapLanguage={checkboxIdToSelectedMapLanguage}
onPanelClick={onPanelClick}
fromBountyPage={true}
selectedWidget={selectedWidget}
loading={loading}
/>
</div>
</div>
</div>
</>
{toastsEl}
</Body>
</>
{toastsEl}
</Body>
)
);
}

Expand Down
Loading
Loading