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

Course card update #283

Merged
merged 7 commits into from
May 22, 2024
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@ docker.env
startBackend.sh

/.env
backend/web-bff/App/.env
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ public void testAddGroupScore() throws Exception {
when(groupFeedbackUtil.checkGroupFeedbackUpdate(groupFeedbackEntity.getGroupId(), groupFeedbackEntity.getProjectId(), getMockUser(), HttpMethod.POST))
.thenReturn(new CheckResult<>(HttpStatus.OK, "", null));
when(groupFeedbackUtil.checkGroupFeedbackUpdateJson(argThat(
json -> json.getScore() == groupFeedbackEntity.getScore() && json.getFeedback().equals(groupFeedbackEntity.getFeedback())), eq(groupFeedbackEntity.getProjectId())))
json -> Objects.equals(json.getScore(), groupFeedbackEntity.getScore()) && json.getFeedback().equals(groupFeedbackEntity.getFeedback())), eq(groupFeedbackEntity.getProjectId())))
.thenReturn(new CheckResult<>(HttpStatus.OK, "", null));
when(groupFeedbackRepository.save(any())).thenReturn(groupFeedbackEntity);
when(entityToJsonConverter.groupFeedbackEntityToJson(groupFeedbackEntity)).thenReturn(groupFeedbackJson);
Expand All @@ -292,7 +292,7 @@ public void testAddGroupScore() throws Exception {
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(content().json(objectMapper.writeValueAsString(groupFeedbackJson)));
verify(groupFeedbackRepository, times(1)).save(argThat(
groupFeedback -> groupFeedback.getScore() == groupFeedbackEntity.getScore() &&
groupFeedback -> Objects.equals(groupFeedback.getScore(), groupFeedbackEntity.getScore()) &&
groupFeedback.getFeedback().equals(groupFeedbackEntity.getFeedback()) &&
groupFeedback.getGroupId() == groupFeedbackEntity.getGroupId() &&
groupFeedback.getProjectId() == groupFeedbackEntity.getProjectId()));
Expand Down
19 changes: 16 additions & 3 deletions frontend/src/pages/index/components/CourseCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useNavigate } from "react-router-dom"
import { AppRoutes } from "../../../@types/routes"
import GroupProgress from "./GroupProgress"
import { CourseProjectsType } from "./CourseSection"
import { Link } from "react-router-dom"

const CourseCard: FC<{ courseProjects: CourseProjectsType[string], adminView?:boolean }> = ({ courseProjects,adminView }) => {
const { t } = useTranslation()
Expand All @@ -32,7 +33,7 @@ const CourseCard: FC<{ courseProjects: CourseProjectsType[string], adminView?:bo
onClick={() => navigate(AppRoutes.COURSE.replace(":courseId", courseProjects.course.courseId.toString()))}
type="inner"
title={courseProjects.course.name}
style={{ width: 300,height:"100%" }}
style={{ width: 300, height:"100%" }}
actions={[
<Tooltip title={t(courseProjects.course.memberCount > 1? "home.projects.userCourseCount_plural": "home.projects.userCourseCount", { count: courseProjects.course.memberCount })}>
<span>
Expand Down Expand Up @@ -60,7 +61,13 @@ const CourseCard: FC<{ courseProjects: CourseProjectsType[string], adminView?:bo
locale={{ emptyText: t("home.projects.noProjects") }}
rowKey="projectId"
renderItem={(project) => (
<Link
to={AppRoutes.PROJECT.replace(":courseId", courseProjects.course.courseId.toString()).replace(":projectId", project.projectId.toString())}
style={{ color: token.colorPrimary, textDecoration: 'none' }}
onClick={(event) => event.stopPropagation()}
>
<List.Item
className="list-item-hover"
actions={[
project.status ? (
<ProjectStatusTag
Expand All @@ -74,10 +81,16 @@ const CourseCard: FC<{ courseProjects: CourseProjectsType[string], adminView?:bo
/>,
]}
>
<List.Item.Meta title={<Typography.Text ellipsis>{project.name}</Typography.Text>} />
<List.Item.Meta title={
<Link to={AppRoutes.PROJECT.replace(":courseId", courseProjects.course.courseId.toString()).replace(":projectId", project.projectId.toString())} style={{ color: token.colorPrimary }}
onClick={(event) => event.stopPropagation()}>
<Typography.Text ellipsis style={{marginLeft: '10px'}}>{project.name}</Typography.Text>
</Link>}/>
</List.Item>
</Link>
)}
></List>
>
</List>
</Card>
)
}
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/pages/project/Project.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import useCourse from "../../hooks/useCourse"
import useProject from "../../hooks/useProject"
import ScoreCard from "./components/ScoreTab"
import {
CalendarOutlined,
ClockCircleOutlined,
DeleteOutlined, EyeInvisibleOutlined, EyeOutlined,
FileDoneOutlined,
Expand All @@ -25,7 +24,6 @@ import SubmissionsTab from "./components/SubmissionsTab"
import MarkdownTextfield from "../../components/input/MarkdownTextfield"
import useApi from "../../hooks/useApi"
import i18n from "i18next";
import useUser from "../../hooks/useUser";

// dracula, darcula,oneDark,vscDarkPlus | prism, base16AteliersulphurpoolLight, oneLight

Expand Down Expand Up @@ -165,6 +163,7 @@ const Project = () => {

return (
<div style={{ margin: "3rem 0", marginTop: "1rem", width: "100%", paddingBottom: "3rem" }}>

<Card
styles={{
header: {
Expand Down
15 changes: 15 additions & 0 deletions frontend/src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -256,4 +256,19 @@ html {
.nav-logo {
display: none;
}
}

.list-item-hover {
cursor: pointer;
transition: background-color 0.15s ease-in-out;
width: 300px;
margin-left: -23px;
}

.dark-theme .list-item-hover:hover {
background-color: rgba(255 255 255 / 5%);
}

.light-theme .list-item-hover:hover {
background-color: rgba(0 0 0 / 5%);
}
Loading