Skip to content

Commit

Permalink
Merge pull request stakwork#834 from aliraza556/feature/bounty-landin…
Browse files Browse the repository at this point in the history
…g-page-enhancements

✨ Add How to Earn Steps and Featured Bounties to Landing Page 🎯
  • Loading branch information
humansinstitute authored Jan 1, 2025
2 parents d3838f5 + 4da7dc2 commit b0ae922
Show file tree
Hide file tree
Showing 13 changed files with 242 additions and 20 deletions.
35 changes: 27 additions & 8 deletions src/bounties/BountyDescription.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,35 @@ interface codingLangProps {
interface bounty_description_props {
isPaid?: any;
color?: any;
isBountyLandingPage?: boolean;
}

const BountyDescriptionContainer = styled.div<bounty_description_props>`
display: flex;
flex-direction: column;
height: 100%;
min-width: 519px;
max-width: 519px;
min-width: ${(props: any) => (props.isBountyLandingPage ? '270px' : '519px')};
max-width: ${(props: any) => (props.isBountyLandingPage ? '270px' : '519px')};
padding-left: 17px;
padding-right: 17px;
`;

const Header = styled.div`
interface bounty_header_props {
isBountyLandingPage?: boolean;
}

const Header = styled.div<bounty_header_props>`
display: flex;
flex-direction: row;
justify-content: space-between;
height: 32px;
margin-top: 16px;
margin-left: 0;
.NameContainer {
display: flex;
flex-direction: column;
width: ${(props: any) => (props.isBountyLandingPage ? '320px' : '')};
}
`;

Expand Down Expand Up @@ -75,11 +83,16 @@ const Description = styled.div<bounty_description_props>`
}
`;

const LanguageContainer = styled.div`
interface LanguageContainerProps {
isBountyLandingPage?: boolean;
}

const LanguageContainer = styled.div<LanguageContainerProps>`
display: flex;
flex-wrap: wrap;
width: 80%;
margin-top: 10px;
margin-left: ${(p: any) => (p.isBountyLandingPage ? '95px' : '0px')};
`;

const CodingLabels = styled.div<codingLangProps>`
Expand Down Expand Up @@ -121,6 +134,8 @@ const BountyDescription = (props: BountiesDescriptionProps) => {
const [replitLink, setReplitLink] = useState('');
const [descriptionImage, setDescriptionImage] = useState('');

const { isBountyLandingPage } = props;

useEffect(() => {
if (props.description) {
const found = props?.description.match(/(https?:\/\/.*\.(?:png|jpg|jpeg|gif))(?![^`]*`)/);
Expand All @@ -147,8 +162,11 @@ const BountyDescription = (props: BountiesDescriptionProps) => {

return (
<>
<BountyDescriptionContainer style={{ ...props.style }}>
<Header>
<BountyDescriptionContainer
style={{ ...props.style }}
isBountyLandingPage={isBountyLandingPage}
>
<Header isBountyLandingPage={isBountyLandingPage}>
<div className="NameContainer">
<NameTag
{...props}
Expand Down Expand Up @@ -200,15 +218,16 @@ const BountyDescription = (props: BountiesDescriptionProps) => {
<EuiText
className="DescriptionTitle"
style={{
color: props.isPaid ? color.grayish.G50 : color.grayish.G10
color: props.isPaid ? color.grayish.G50 : color.grayish.G10,
marginLeft: isBountyLandingPage ? '95px' : '0px'
}}
>
{props.title?.slice(0, descriptionImage ? 80 : 120)}
{props.title?.length > 80 ? '...' : ''}
</EuiText>
</div>
</Description>
<LanguageContainer>
<LanguageContainer isBountyLandingPage={isBountyLandingPage}>
{replitLink && (
<div onClick={() => window.open(replitLink[0])} style={{ display: 'flex' }}>
<CodingLabels
Expand Down
3 changes: 3 additions & 0 deletions src/bounties/BountyPrice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ interface PriceContainerProps {
price_Text_Color?: string;
priceBackground?: string;
session_text_color?: string;
isBountyLandingPage?: boolean;
}

const PriceContainer = styled.div<PriceContainerProps>`
Expand All @@ -18,6 +19,7 @@ const PriceContainer = styled.div<PriceContainerProps>`
align-items: flex-start;
padding: 0px 24px;
color: #909baa;
margin-left: ${(props: any) => (props.isBountyLandingPage ? '200px' : '0')};
padding-top: 41px;
.PriceStaticTextContainer {
width: 28px;
Expand Down Expand Up @@ -101,6 +103,7 @@ const BountyPrice = (props: BountiesPriceProps) => {
style={{
...props.style
}}
isBountyLandingPage={props.isBountyLandingPage}
>
<div
style={{
Expand Down
11 changes: 9 additions & 2 deletions src/bounties/BountyProfileView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,17 @@ interface BountyProfileViewProps {
View_profile_icon_color?: string;
}

const UserProfileContainer = styled.div`
interface IUserProfileContainer {
isBountyLandingPage?: boolean;
}

const UserProfileContainer = styled.div<IUserProfileContainer>`
min-width: 336px;
max-width: 336px;
display: flex;
padding: 40px 0px 0px 37px;
padding: ${(props: any) =>
props.isBountyLandingPage ? '40px 0px 0px 20px' : '40px 0px 0px 37px'};
margin-left: ${(props: any) => (props.isBountyLandingPage ? '-10px' : '0')};
`;

const UserImage = styled.div`
Expand Down Expand Up @@ -127,6 +133,7 @@ const BountyProfileView = (props: BountiesProfileProps) => {
style={{
...props?.UserProfileContainerStyle
}}
isBountyLandingPage={props.isBountyLandingPage}
>
<UserImage
style={{
Expand Down
3 changes: 3 additions & 0 deletions src/bounties/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface BountiesDescriptionProps {
uuid?: string;
org_uuid?: string;
org_img?: string;
isBountyLandingPage?: boolean;
}

export interface BountiesPriceProps {
Expand All @@ -25,6 +26,7 @@ export interface BountiesPriceProps {
price: number;
style?: React.CSSProperties;
priceMax?: number;
isBountyLandingPage?: boolean;
}

export interface BountiesProfileProps {
Expand All @@ -42,4 +44,5 @@ export interface BountiesProfileProps {
height: string;
background: string;
};
isBountyLandingPage?: boolean;
}
70 changes: 70 additions & 0 deletions src/components/BountyComponents/BountySteps.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import React from 'react';
import styled from 'styled-components';
import { colors } from '../../config/colors';

const StepsContainer = styled.div`
display: flex;
flex-direction: column;
gap: 2px;
margin: 20px 0;
`;

const StepItem = styled.div`
display: flex;
align-items: flex-start;
gap: 4px;
font-size: 16px;
margin-left: 2%;
color: ${colors.light.text1};
`;

const StepLabel = styled.span`
font-weight: 800;
font-size: 18px;
`;

const StepText = styled.span`
font-weight: 500;
`;

const StepTitle = styled.h6`
font-size: 20px;
font-family: 'Barlow';
font-weight: 800;
color: ${colors.light.text1};
margin-bottom: 20px;
`;

interface Step {
text: string;
}

const steps: Step[] = [
{
text: 'Sign up for a Sphinx by clicking the Get Sphinx button!'
},
{
text: 'Check out the open bounties, by clicking bounties!'
},
{
text: 'Reach out to the bounty provider by clicking "I can help!"'
},
{
text: 'Introduce yourself and get assigned'
},
{
text: 'Compelte the work and get paid directly to your Sphinx Wallet!'
}
];

export const BountySteps: React.FC = () => (
<StepsContainer>
<StepTitle>If you want to earn bounties</StepTitle>
{steps.map((step: Step, index: number) => (
<StepItem key={index}>
<StepLabel>{`Step ${index + 1}:`}</StepLabel>
<StepText>{step.text}</StepText>
</StepItem>
))}
</StepsContainer>
);
92 changes: 92 additions & 0 deletions src/components/BountyComponents/FeaturedBounties.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import React, { useState } from 'react';
import styled from 'styled-components';
import { observer } from 'mobx-react-lite';
import { DisplayBounties } from '../../people/widgetViews/workspace/style';
import { colors } from '../../config/colors';
import { bountyStore } from '../../store/bountyStore';
import WidgetSwitchViewer from '../../people/widgetViews/WidgetSwitchViewer';

const FeaturedContainer = styled.div`
margin: 20px 0;
`;

const FeaturedHeader = styled.div`
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 16px;
h2 {
font-size: 18px;
font-weight: 600;
color: ${colors.light.text1};
margin: 0;
}
`;

export const FeaturedBounties: React.FC = observer(() => {
const featuredBounty = bountyStore.getFeaturedBounty();
const [currentItems, setCurrentItems] = useState<number>(1);
const [page, setPage] = useState<number>(1);

const widgetViewerProps = {
onPanelClick: (activeWorkspace?: string, bounty?: any) => {
if (bounty?.id) {
window.location.href = featuredBounty?.url || '';
}
},
checkboxIdToSelectedMap: {},
checkboxIdToSelectedMapLanguage: {},
fromBountyPage: true,
selectedWidget: 'bounties',
isBountyLandingPage: true,
loading: false,
currentItems,
setCurrentItems: (items: number) => setCurrentItems(items),
page,
setPage: (newPage: number) => setPage(newPage),
languageString: '',

bounties: featuredBounty
? [
{
body: {
id: featuredBounty.bountyId
},
person: {
wanteds: []
}
}
]
: []
};

return (
<FeaturedContainer>
<FeaturedHeader>
<h2>Featured Bounties</h2>
</FeaturedHeader>

<DisplayBounties>
<div
style={{
width: 'auto',
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
height: '50%',
overflowY: 'auto'
}}
>
{featuredBounty ? (
<WidgetSwitchViewer {...widgetViewerProps} />
) : (
<div style={{ color: colors.light.text2, textAlign: 'center', padding: '20px' }}>
No featured bounties at the moment
</div>
)}
</div>
</DisplayBounties>
</FeaturedContainer>
);
});
10 changes: 10 additions & 0 deletions src/components/BountyComponents/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react';
import { BountySteps } from './BountySteps';
import { FeaturedBounties } from './FeaturedBounties';

export const BountyComponents = () => (
<>
<BountySteps />
<FeaturedBounties />
</>
);
8 changes: 5 additions & 3 deletions src/pages/BountiesLandingPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { colors } from '../../config/colors';
import { BountiesHeader, HeaderWrap, Leftheader } from '../tickets/style.ts';
import { BountyHeaderContent } from '../tickets/workspace/workspaceHeader/WorkspaceHeaderStyles.tsx';
import TopEarners from '../../components/common/TopEarners/index.tsx';
import { BountyComponents } from '../../components/BountyComponents';

const BountiesLandingPage: React.FC = () => {
const isMobile = useIsMobile();
Expand All @@ -25,8 +26,8 @@ const BountiesLandingPage: React.FC = () => {
`;

const ContentWrapper = styled.div`
max-width: 1200px;
min-height: 500px;
max-width: 1500px;
min-height: 650px;
margin: 30px auto;
width: 100%;
padding: 40px 20px 20px 30px;
Expand All @@ -43,7 +44,7 @@ const BountiesLandingPage: React.FC = () => {
&:after {
content: '';
position: absolute;
left: 63%;
left: 68%;
top: 0;
bottom: 0;
width: 1px;
Expand Down Expand Up @@ -103,6 +104,7 @@ const BountiesLandingPage: React.FC = () => {
Building the modern marketplace for work. Complete a bounty and get paid in Bitcoin
instantly! ⚡
</p>
<BountyComponents />
</Column>
<Column>
<h1>Freedom to Earn!</h1>
Expand Down
Loading

0 comments on commit b0ae922

Please sign in to comment.