Skip to content

Commit

Permalink
add playlist indictor
Browse files Browse the repository at this point in the history
  • Loading branch information
younes200 committed Oct 9, 2023
1 parent 7247459 commit eb5dd40
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 20 deletions.
6 changes: 1 addition & 5 deletions apps/frontend/src/components/AppBarMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,7 @@ export const AppBarMenuWrapper: React.FC<Props> = ({
navigate("/");
};
return (
<Box
display={"flex"}
flexDirection={"column"}
sx={{ height: "100vh", minHeight: "100vh" }}
>
<Box sx={{ height: "100vh", minHeight: "100vh" }}>
<AppBar color="default" position="fixed">
<Toolbar disableGutters>
<Box flexGrow={1}>
Expand Down
16 changes: 15 additions & 1 deletion apps/frontend/src/components/ProjectSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { Box, Typography } from "@mui/material";
import * as React from "react";
import { Trans, useTranslation } from "react-i18next";

import { trpc } from "~utils/trpc";

import { ProjectUserAvatar } from "./ProjectUserAvatar";

interface Props {
Expand All @@ -11,9 +13,21 @@ interface Props {

const ProjectSummary: React.FC<Props> = ({ project }: Props) => {
const { t } = useTranslation();

const { data: dataproject } = trpc.project.byId.useQuery({ id: project.id });

return (
<Box sx={{ padding: 0 }}>
<Typography align="left" variant="h3" gutterBottom={true}>
{dataproject && dataproject.playlist ? (
<Typography align="justify" variant="body1">
<Trans i18nKey="project.summary.playlist.title">
Liste de lecture :{" "}
</Trans>
{dataproject.playlist.title}
</Typography>
) : null}

<Typography align="left" variant="h3">
{project.title}
</Typography>

Expand Down
1 change: 0 additions & 1 deletion apps/frontend/src/components/home/ProjectGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import { TransitionGroup } from "react-transition-group";
import { useDidUpdate } from "rooks";

import { StyledTitle } from "~components/typography";
import { useMe, useProjects } from "~hooks/use-user";
import { isAdmin, isMember, isOwner } from "~utils/ProjectUtils";
import { ProjectList, trpc } from "~utils/trpc";

Expand Down
28 changes: 18 additions & 10 deletions apps/frontend/src/components/home/ProjectThumbnail.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import { ProjectGraphRecord } from "@celluloid/types";
// import { connect } from "react-redux";
// import { useNavigate } from "react-router-dom";
// import { AnyAction, Dispatch } from "redux";
import PlaylistPlayIcon from "@mui/icons-material/PlaylistPlay";
import {
Box,
Card,
CardContent,
Chip,
Grid,
styled,
Typography,
Expand All @@ -12,9 +17,6 @@ import * as React from "react";

import { ProjectThumbnailImage } from "~components/ProjectThumbnailImage";
import { ProjectUserAvatar } from "~components/ProjectUserAvatar";
// import { connect } from "react-redux";
// import { useNavigate } from "react-router-dom";
// import { AnyAction, Dispatch } from "redux";

const StyledBox = styled(Box)(() => ({
position: "relative",
Expand Down Expand Up @@ -46,6 +48,8 @@ const ProjectThumbnail: React.FC<Props> = ({ project }) => {
window.location.assign(`/projects/${project.id}`);
};

console.log(project);

return (
// <ThemeProvider theme={modalTheme}>
// <Grow
Expand All @@ -70,18 +74,22 @@ const ProjectThumbnail: React.FC<Props> = ({ project }) => {
height={"20vh"}
bgColor="#000000"
/>
{/* <Box
{project.playlist && (
<Box
sx={{
position: "absolute",
top: 0,
left: 94,
right: 0,
right: 5,
bottom: 5,
}}
>
<PlayCircleIcon
sx={{ color: "white", fontSize: 100, opacity: 0.8 }}
<Chip
label={project.playlist?._count.projects}
icon={<PlaylistPlayIcon />}
color="secondary"
variant="outlined"
/>
</Box> */}
</Box>
)}
</StyledBox>

<StyledCardContent sx={{ paddingX: 1, paddingTop: 2, paddingBottom: 0 }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export interface Member extends UserRecord {
}

interface Props {
user?: UserRecord;
project: ProjectGraphRecord;
members: Set<Member>;
setPublicLoading: boolean;
Expand All @@ -57,7 +56,6 @@ interface Props {
}

const SideBarComponenent: React.FC<Props> = ({
user,
project,
members,
setCollaborativeLoading,
Expand All @@ -78,6 +76,7 @@ const SideBarComponenent: React.FC<Props> = ({

const { data: annotations } = useGetAnnotationsQuery(project.id);

const { data: user } = trpc.user.me.useQuery();
const { data: dataproject } = trpc.project.byId.useQuery({ id: project.id });

const handleDelete = () => {
Expand Down Expand Up @@ -122,7 +121,7 @@ const SideBarComponenent: React.FC<Props> = ({
borderRadius: 2,
}}
>
{user && isOwner(project, user) ? (
{user && project.userId == user.id ? (
<>
<Typography variant="h6" mb={2}>
{t("project.edit", "Modification")}
Expand Down

0 comments on commit eb5dd40

Please sign in to comment.