From 247daaad15be0bb6705e02eea41b9a9bec851d33 Mon Sep 17 00:00:00 2001 From: Kevin Charles Date: Wed, 12 Apr 2023 16:55:24 +0000 Subject: [PATCH] Update cards --- src/Tools/_framework/Paths/Community.jsx | 128 ++---------------- .../Paths/PortfolioActivitySettings.jsx | 4 +- .../_framework/Paths/PublicPortfolio.jsx | 128 +++++++++--------- .../PanelHeaderComponents/ActivityCard.jsx | 20 ++- .../PanelHeaderComponents/AuthorCard.jsx | 27 ++++ .../RecoilActivityCard.jsx | 2 +- 6 files changed, 123 insertions(+), 186 deletions(-) create mode 100644 src/_reactComponents/PanelHeaderComponents/AuthorCard.jsx diff --git a/src/Tools/_framework/Paths/Community.jsx b/src/Tools/_framework/Paths/Community.jsx index 79f24ff2ac..771325da44 100644 --- a/src/Tools/_framework/Paths/Community.jsx +++ b/src/Tools/_framework/Paths/Community.jsx @@ -1,9 +1,7 @@ import React, { useState } from 'react'; import { - Avatar, Badge, Box, - Image, Icon, Tab, TabList, @@ -18,8 +16,10 @@ import { useLoaderData } from 'react-router'; import styled from 'styled-components'; import { Carousel } from '../../../_reactComponents/PanelHeaderComponents/Carousel'; import Searchbar from '../../../_reactComponents/PanelHeaderComponents/SearchBar'; -import { Form, Link } from 'react-router-dom'; +import { Form } from 'react-router-dom'; import { RiEmotionSadLine } from 'react-icons/ri'; +import ActivityCard from '../../../_reactComponents/PanelHeaderComponents/ActivityCard'; +import AuthorCard from '../../../_reactComponents/PanelHeaderComponents/AuthorCard'; export async function loader({ request }) { const url = new URL(request.url); @@ -36,114 +36,6 @@ export async function loader({ request }) { } } -function ActivityCard({ doenetId, imagePath, label, fullName }) { - if (!imagePath) { - imagePath = '/activity_default.jpg'; - } - const activityLink = `/portfolioviewer/${doenetId}`; - - return ( - - - - Activity Card - - - - - - - {fullName} - - - - - {label} - - - - - ); -} - -function AuthorCard({ fullName, portfolioCourseId }) { - // function AuthorCard({ doenetId, imagePath, label, fullName }) { - - const authorLink = `/publicportfolio/${portfolioCourseId}`; - - return ( - - - - - - - - - - {fullName} - - - - - ); -} - function Heading(props) { return (
{ if (itemObj?.type == 'activity') { const { doenetId, imagePath, label, fullName } = itemObj; + const imageLink = `/portfolioviewer/${doenetId}`; + return ( ); } @@ -338,10 +233,12 @@ export function Community() { {searchResults?.activities.map((activityObj) => { const { doenetId, imagePath, label, fullName } = activityObj; //{ activityLink, doenetId, imagePath, label, fullName } + const imageLink = `/portfolioviewer/${doenetId}`; + return ( { const { courseId, firstName, lastName } = authorObj; // console.log("authorObj",authorObj) + const imageLink = `/publicportfolio/${courseId}`; return ( ); })} diff --git a/src/Tools/_framework/Paths/PortfolioActivitySettings.jsx b/src/Tools/_framework/Paths/PortfolioActivitySettings.jsx index e1ca543c34..bc7dd53e34 100644 --- a/src/Tools/_framework/Paths/PortfolioActivitySettings.jsx +++ b/src/Tools/_framework/Paths/PortfolioActivitySettings.jsx @@ -175,8 +175,8 @@ export function PortfolioActivitySettings() { let image = await window.BrowserImageResizer.readAndCompressImage(file, { quality: 0.9, - maxWidth: 176, - maxHeight: 127, + maxWidth: 350, + maxHeight: 253, debug: true, }); // const convertToBase64 = (blob) => { diff --git a/src/Tools/_framework/Paths/PublicPortfolio.jsx b/src/Tools/_framework/Paths/PublicPortfolio.jsx index 04ef81fc39..4df74cddf8 100644 --- a/src/Tools/_framework/Paths/PublicPortfolio.jsx +++ b/src/Tools/_framework/Paths/PublicPortfolio.jsx @@ -1,5 +1,5 @@ // import axios from 'axios'; -import { Avatar, Box, Image, Text } from '@chakra-ui/react'; +import { Avatar, Box, Image, Text, Wrap } from '@chakra-ui/react'; import React from 'react'; import { redirect, @@ -9,6 +9,7 @@ import { Link, } from 'react-router-dom'; import styled from 'styled-components'; +import ActivityCard from '../../../_reactComponents/PanelHeaderComponents/ActivityCard'; // import Button from '../../../_reactComponents/PanelHeaderComponents/Button'; // export async function action() { @@ -56,62 +57,62 @@ const CardsContainer = styled.div` width: calc(100vw - 40px); `; -function Card({ doenetId, imagePath, label, pageDoenetId, fullName }) { - const activityLink = `/portfolioviewer/${doenetId}`; +// function Card({ doenetId, imagePath, label, pageDoenetId, fullName }) { +// const activityLink = `/portfolioviewer/${doenetId}`; - return ( - - - - Activity Card - - - - - - - {fullName} - - - - - {label} - - - - - ); -} +// return ( +// +// +// +// Activity Card +// +// +// +// +// +// +// {fullName} +// +// +// +// +// {label} +// +// +// +// +// ); +// } const PortfolioGrid = styled.div` display: grid; @@ -150,23 +151,28 @@ export function PublicPortfolio() { - + {data.publicActivities.length < 1 ? (
No Public Activities
) : ( <> {data.publicActivities.map((activity) => { + const { doenetId, label, imagePath } = activity; + const imageLink = `/portfolioviewer/${doenetId}`; + return ( - ); })} )} -
+
diff --git a/src/_reactComponents/PanelHeaderComponents/ActivityCard.jsx b/src/_reactComponents/PanelHeaderComponents/ActivityCard.jsx index 4bc62c3ed8..44df7f06b5 100644 --- a/src/_reactComponents/PanelHeaderComponents/ActivityCard.jsx +++ b/src/_reactComponents/PanelHeaderComponents/ActivityCard.jsx @@ -17,16 +17,21 @@ import { GoKebabVertical } from 'react-icons/go'; import { Link } from 'react-router-dom'; export default function ActivityCard({ - imageLink, + imageLink = '', imagePath, label, fullName, + // menuItems, }) { + if (!imagePath) { + imagePath = '/activity_default.jpg'; + } + //Note: when we have a menu width 140px becomes 120px return ( Activity Card Image - + {label} - + {fullName} - + {/* @@ -62,7 +68,7 @@ export default function ActivityCard({ three four - + */} diff --git a/src/_reactComponents/PanelHeaderComponents/AuthorCard.jsx b/src/_reactComponents/PanelHeaderComponents/AuthorCard.jsx new file mode 100644 index 0000000000..248b39060b --- /dev/null +++ b/src/_reactComponents/PanelHeaderComponents/AuthorCard.jsx @@ -0,0 +1,27 @@ +import React from 'react'; +import { Avatar, Text, Card, CardBody, Center } from '@chakra-ui/react'; +import { Link } from 'react-router-dom'; + +export default function AuthorCard({ imageLink, fullName }) { + return ( + + +
+ +
+ + +
+ + {fullName} + +
+
+
+ ); +} diff --git a/src/_reactComponents/PanelHeaderComponents/RecoilActivityCard.jsx b/src/_reactComponents/PanelHeaderComponents/RecoilActivityCard.jsx index ce7e72164d..b4f9221fc2 100644 --- a/src/_reactComponents/PanelHeaderComponents/RecoilActivityCard.jsx +++ b/src/_reactComponents/PanelHeaderComponents/RecoilActivityCard.jsx @@ -64,7 +64,7 @@ export default function RecoilActivityCard({