Skip to content

Commit

Permalink
Merge pull request #1844 from dev-launchers/master
Browse files Browse the repository at this point in the history
latest changes
  • Loading branch information
dbradham committed Jun 30, 2024
2 parents d64ac54 + 7f830ab commit 40c0599
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 37 deletions.
70 changes: 34 additions & 36 deletions apps/ideaspace/src/components/common/IdeaCard/IdeaCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@ import { LikeButton } from '@devlaunchers/components/src/components/molecules';
import { useUserDataContext } from '@devlaunchers/components/context/UserDataContext';
import { agent } from '@devlaunchers/utility';


function IdeaCard({ cards, cardType }) {
const [tagContent, setTagContent] = useState(cards.status);
const [buttonContent, setButtonContent] = useState('');
const [urlPath, setUrlPath] = useState('');
const [liked, setLiked] = useState(false);
const { isAuthenticated, userData } = useUserDataContext();


const [UpdateFailure, confirmFailure] = useConfirm(
['Unable to reactivate your idea', '', ''],
Expand All @@ -26,9 +24,9 @@ function IdeaCard({ cards, cardType }) {
);

useEffect(() => {
if (cardType == "mine") {
if (tagContent !== "archived") {
setButtonContent(`WORKSHOP THIS IDEA`);
if (cardType == 'mine') {
if (tagContent !== 'archived') {
setButtonContent(`Edit This Idea`);
} else {
setButtonContent(`REACTIVATE THIS IDEA`);
}
Expand All @@ -44,7 +42,10 @@ function IdeaCard({ cards, cardType }) {
setButtonContent(`WAIT`);

try {
const res = await agent.Ideas.getIdea(cards.id, new URLSearchParams(`populate=*`));
const res = await agent.Ideas.getIdea(
cards.id,
new URLSearchParams(`populate=*`)
);

if (res.status === 200) {
setTagContent('workshopping');
Expand All @@ -63,24 +64,18 @@ function IdeaCard({ cards, cardType }) {
borderRadius: '1rem',
}}
>

<atoms.Box>
<IdeaCardTag
status={tagContent}
/>
<IdeaCardTag status={tagContent} />
</atoms.Box>

<IdeaCardImg
cardId={cards.id}
cardImg={cards.imgSrc}
/>
<IdeaCardImg cardId={cards.id} cardImg={cards.imgSrc} />

<Link href={{ pathname: urlPath }}>
<atoms.Box
flexDirection='column'
alignItems='flex-start'
justifyContent='space-between'
padding='0rem 2rem 2rem'
<atoms.Box
flexDirection="column"
alignItems="flex-start"
justifyContent="space-between"
padding="0rem 2rem 2rem"
style={{ maxWidth: '18.5rem' }}
>
<atoms.Typography
Expand All @@ -90,28 +85,31 @@ function IdeaCard({ cards, cardType }) {
{cards.ideaName}
</atoms.Typography>

<atoms.Box alignItems='center' >
<atoms.Typography type='p' style={{ fontSize: '1rem', textAlign: 'left' }} />
<atoms.Box alignItems="center">
<atoms.Typography
type="p"
style={{ fontSize: '1rem', textAlign: 'left' }}
/>
<IdeaCardComment commentLength={cards.comments?.length} />
</atoms.Box>
<IdeaCardUpdated updatedAt={cards.mostRecentCommentTime} />
<IdeaCardUpdated updatedAt={cards.mostRecentCommentTime} />
</atoms.Box>
</Link>

{isAuthenticated ? <atoms.Box padding="0rem 2rem 2rem">
<LikeButton
onClick={() => setLiked((prev) => !prev)}
filled={liked}
text={liked ? 1 : ''}
></LikeButton>
</atoms.Box>
: null}

{isAuthenticated ? (
<atoms.Box padding="0rem 2rem 2rem">
<LikeButton
onClick={() => setLiked((prev) => !prev)}
filled={liked}
text={liked ? 1 : ''}
></LikeButton>
</atoms.Box>
) : null}

{tagContent == "archived" ? (
{tagContent == 'archived' ? (
<atoms.Button
buttonSize='standard'
buttonType='alternative'
buttonSize="standard"
buttonType="alternative"
style={{ margin: '0rem 2rem 1.5rem' }}
onClick={reactivateIdea}
>
Expand All @@ -120,8 +118,8 @@ function IdeaCard({ cards, cardType }) {
) : (
<Link href={{ pathname: urlPath }}>
<atoms.Button
buttonSize='standard'
buttonType='alternative'
buttonSize="standard"
buttonType="alternative"
style={{ margin: '0rem 2rem 1.5rem' }}
>
{buttonContent}
Expand Down
2 changes: 1 addition & 1 deletion staging/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ resources:
images:
- name: devlaunchers/platform-website
newName: devlaunchers/platform-website
newTag: "982ce6d-202406290014" # {"$imagepolicy": "platform-website-staging:platform-website:tag"}
newTag: "e9f45a1-202406300106" # {"$imagepolicy": "platform-website-staging:platform-website:tag"}

0 comments on commit 40c0599

Please sign in to comment.