Skip to content

Commit

Permalink
Merge pull request #1957 from dev-launchers/development/ideaspace
Browse files Browse the repository at this point in the history
Development/ideaspace
  • Loading branch information
dbradham authored Sep 8, 2024
2 parents a58a2d7 + 9385e30 commit a84cb05
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 85 deletions.
34 changes: 20 additions & 14 deletions apps/ideaspace/src/components/common/BackButton/BackButton.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,43 @@
import React from 'react';
import Vector from '../../../images/Vector.svg';
import {
GoBack,
} from './StyledBackButton';

const BackButton = ({
buttonType,
clickHandler,
}) => {
import { GoBack } from './StyledBackButton';
import { useRouter } from 'next/router';

const BackButton = ({ buttonType, clickHandler, backRoute }) => {
const router = useRouter();
const goBack = () => {
window.history.back(-1);
if (backRoute) {
router.push(backRoute);
} else {
window.history.back(-1);
}
};

const goBack2 = () => {
clickHandler("back");
if (clickHandler) {
clickHandler('back');
} else if (backRoute) {
router.push(backRoute);
} else {
window.history.back(-1);
}
};

if (buttonType == "confirm") {
if (buttonType == 'confirm') {
return (
<GoBack onClick={goBack2}>
<img alt='backButton' src={Vector} />
<img alt="backButton" src={Vector} />
Back
</GoBack>
);
} else {
return (
<GoBack onClick={goBack}>
<img alt='backButton' src={Vector} />
<img alt="backButton" src={Vector} />
Back
</GoBack>
);
}
};

export default BackButton;
export default BackButton;
15 changes: 10 additions & 5 deletions apps/ideaspace/src/components/common/IdeaForm/IdeaForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const IdeaForm = (
<Field
required
as={organisms.OpenResponse}
label="Do you have any relevant experience in software development or design that you'd like to utilize?:&nbsp;"
label="Do you have any relevant experience in software development or design that you'd like to utilize?&nbsp;"
placeholder="If you have any relevant experience in development or design, please explain here. This information will be shared with Dev Launchers to make decisions on planning and team roles. It won't be publicly shown on the workshopping page."
id="experience"
name="experience"
Expand Down Expand Up @@ -134,7 +134,7 @@ const IdeaForm = (
</atoms.Box>
<Field
as={organisms.OpenResponse}
label="Anything else you would like to share to support your idea?:"
label="Anything else you would like to share to support your idea?"
placeholder="Want to share something else not listed above?"
id="extraInfo"
name="extraInfo"
Expand All @@ -143,7 +143,7 @@ const IdeaForm = (
/>
<Field
as={organisms.FormField}
label="What's a catchy tagline for your idea that sums up your value and purpose: ?"
label="What's a catchy tagline for your idea that sums up your value and purpose?"
placeholder="Your tagline"
id="tagline"
name="tagline"
Expand All @@ -158,9 +158,14 @@ const IdeaForm = (
submission?<span style={{ color: 'red' }}>&nbsp;*</span>
<atoms.ToolTip
content="As an “idea owner” you'll own the idea and be in charge of refine and update the information on the workshopping page."
direction="top"
direction="right"
delay={100}
style={{ marginLeft: '0.1rem', marginBottom: '0.7rem' }}
style={{
marginLeft: '0.1rem',
marginBottom: '0.5rem',
width: '1rem',
height: '1rem',
}}
>
<img alt="submit_image" src={popoverSvg} />
</atoms.ToolTip>
Expand Down
38 changes: 12 additions & 26 deletions apps/ideaspace/src/components/modules/BrowseIdeas/BrowseIdeas.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,6 @@ function BrowseIdeas() {
label: 'Recent Activity',
isAscending: false,
},
{
value: 'updated_at',
label: 'Recent Ideas',
isAscending: false,
},
{
value: 'hourCommitmentMin',
label: 'Time Commitment',
isAscending: true,
},
];

const sortCards = (selectedSortCriterion) => {
Expand Down Expand Up @@ -70,20 +60,24 @@ function BrowseIdeas() {
};

React.useEffect(async () => {
const ideaCards = cleanDataList(await agent.Ideas.get(
new URLSearchParams(`populate=*&pagination[pageSize]=1000`)));
const ideaCards = cleanDataList(
await agent.Ideas.get(
new URLSearchParams(`populate=*&pagination[pageSize]=1000`)
)
);

const getCards = ideaCards.map((item) => {
const getCards = ideaCards.map((item) => {
if (item?.comments?.data) {
item.comments = cleanDataList(item.comments.data);

const recentCommentedTime = item.comments.length > 0 ? new Date(
item.comments[0]?.updatedAt
) : new Date(item.updatedAt);
const recentCommentedTime =
item.comments.length > 0
? new Date(item.comments[0]?.updatedAt)
: new Date(item.updatedAt);

return {
...item,
mostRecentCommentTime: recentCommentedTime
mostRecentCommentTime: recentCommentedTime,
};
}
return {
Expand Down Expand Up @@ -123,7 +117,7 @@ function BrowseIdeas() {
<StyledRanbow>
<atoms.Layer hasRainbowBottom />
</StyledRanbow>
<BackButton />
<BackButton backRoute={'/ideaspace'} />
<atoms.Typography type="h4">
Want to help develop an idea?
<br />
Expand All @@ -148,14 +142,6 @@ function BrowseIdeas() {
disabled: false,
text: 'Recent Activity',
},
{
disabled: false,
text: 'Recent Ideas',
},
{
disabled: false,
text: 'Time Commitment',
},
]}
recieveValue={(value) => {
sortCards(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,22 +116,14 @@ function SubmissionForm() {
}
}, [unsavedChanges, urrl]);*/

const backHandler = (url) => {
/*if (unsavedChanges) {
handleDialog(url);
} else {
*/ window.history.back(-1);
//}
};

return (
<>
<HeadWapper>
<Headline>Submit an idea</Headline>
<StyledRanbow>
<atoms.Layer hasRainbowBottom />
</StyledRanbow>
<BackButton buttonType="confirm" clickHandler={backHandler} />
<BackButton buttonType="confirm" backRoute={'/ideaspace'} />
<atoms.Typography type="h4">
Have an idea for a software project but need developers to build it?
<br />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export const IdeaOverview = ({ selectedCard }) => {
IdeaOwnerName={authorName}
ideaOwnerImage={selectedCard.id}
/>
<TagsCard status={selectedCard.difficultyLevel} />
</TopView>
<IdeaContentCard
title={'Idea features'}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
import React, { useState } from 'react';
import Error from "next/error";
import Error from 'next/error';
import { useRouter } from 'next/router';
import DisplayComments from './CommentsForm/DisplayComments';
import CommentForm from './CommentsForm/CommentForm';
import { IdeaOverview } from './IdeaOverview/IdeaOverview';
import { atoms } from '@devlaunchers/components/src/components';
import BackButton from '../../common/BackButton/BackButton';
import theme from '../../../styles/theme';
import CircularIndeterminateLoader from '../Loader/CircularIndeterminateLoader'
import CircularIndeterminateLoader from '../Loader/CircularIndeterminateLoader';
import useConfirm from '../../common/DialogBox/DialogBox';
import {
Form,
Comments
} from './CommentsForm/StyledComments';

import { Form, Comments } from './CommentsForm/StyledComments';

import {
Container,
Expand All @@ -27,23 +23,27 @@ import {
import { useFetchIdea } from './useFetchIdea';

export default function WorkshoppingPage(props) {
const router = useRouter();

const router = useRouter()

React.useEffect(() => {
if(!router.isReady){ return; }
if (!router.isReady) {
return;
}
}, [router.isReady]);

const [comments, setComments] = useState([]);

const [handleChange, setHandleChange] = useState('');

const { data, loading, hidden, getError } = useFetchIdea(router.query.ideaId, setComments);

const { data, loading, hidden, getError } = useFetchIdea(
router.query.ideaId,
setComments
);

const [ArchivedIdea, confirmArchived] = useConfirm(
["This Idea has been archived.", '', ''],
['This Idea has been archived.', '', ''],
"You can't workshop on it.",
['primary', 'got it', ''],
['primary', 'got it', '']
);

React.useEffect(async () => {
Expand All @@ -60,7 +60,6 @@ export default function WorkshoppingPage(props) {
if (getError) {
return <Error statusCode={404} title="page Not Found" />;
} else {

return (
<Container theme={theme}>
<ArchivedIdea />
Expand All @@ -70,36 +69,39 @@ export default function WorkshoppingPage(props) {
<StyledRanbow>
<atoms.Layer hasRainbowBottom />
</StyledRanbow>
<BackButton />
<BackButton backRoute={'/ideaspace/browse'} />
<ParaWrapper>
<atoms.Typography type='p' style={{ fontSize: '1.2rem' }}>
Want to help this product idea? Comment and ideate this idea with other people to help
it become an open source project
<atoms.Typography type="p" style={{ fontSize: '1.2rem' }}>
Want to help this product idea? Comment and ideate this idea with
other people to help it become an open source project
</atoms.Typography>
</ParaWrapper>
</HeadWapper>

{loading === true ?
<CircularIndeterminateLoader
text="Loading..."
color="white"
/>
:
{loading === true ? (
<CircularIndeterminateLoader text="Loading..." color="white" />
) : (
<Wrapper>
<IdeaOverview selectedCard={data} />

<Comments>
<h5 style={{textAlign: "left", paddingLeft: "20px"}}>COMMENT FEED: {comments.length}</h5>
<h5 style={{ textAlign: 'left', paddingLeft: '20px' }}>
COMMENT FEED: {comments.length}
</h5>

<Form>
<CommentForm selectedCard={data} comments={comments} renderNewComment={renderNewComment} />
<CommentForm
selectedCard={data}
comments={comments}
renderNewComment={renderNewComment}
/>
</Form>

<DisplayComments selectedCard={data} comments={comments} />
</Comments>
</Wrapper>
}
)}
</Container>
);
}
}
}

0 comments on commit a84cb05

Please sign in to comment.