Skip to content

Commit

Permalink
202 admin interface 2 (#207)
Browse files Browse the repository at this point in the history
* fix assets

* update client to add admin menu

* update translation

* fix admin menu
  • Loading branch information
younes200 authored May 8, 2023
1 parent 74814db commit fdcf124
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 15 deletions.
Binary file modified .yarn/install-state.gz
Binary file not shown.
6 changes: 3 additions & 3 deletions packages/admin/src/my-input.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import React from "react";

// just some regular React component
const MyInputComponent = () => <p>test</p>
const MyInputComponent = () => <p></p>;

export default MyInputComponent
export default MyInputComponent;
18 changes: 12 additions & 6 deletions packages/admin/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ const getAdminRouter = (options: Partial<AdminJSOptions> = {}) => {
branding: {
companyName: 'Celluloid',
withMadeWithLove: false,
logo: '/assets/images/logo.svg',
logo: '/admin/assets/images/logo.svg',
theme: overrides
},
assets: {
styles: ['/assets/styles/override.css'],
styles: ['/admin/assets/styles/override.css'],
},
dashboard: {
component: Components.MyInput,
Expand All @@ -76,8 +76,8 @@ const getAdminRouter = (options: Partial<AdminJSOptions> = {}) => {
name: 'Users',
icon: 'User',
},
listProperties: ['id', 'email', 'username', 'role', 'code', 'confirmed'],
filterProperties: ['email', 'username', 'role'],
listProperties: ['email', 'username', 'role', 'code', 'confirmed'],
filterProperties: ['email', 'username',],
editProperties: ['username', 'confirmed', 'role'],
actions: {
new: {
Expand All @@ -94,8 +94,8 @@ const getAdminRouter = (options: Partial<AdminJSOptions> = {}) => {
name: 'Projects',
icon: 'Play',
},
listProperties: ['title', 'description', 'public', 'shared', 'publishedAt'],
filterProperties: ['title', 'description', 'publishedAt'],
listProperties: ['title', 'description', 'public', 'shared', 'publishedAt', 'User'],
filterProperties: ['title', 'description', 'User'],
editProperties: ['title', 'description', 'public', 'shared'],
actions: {
new: {
Expand All @@ -117,6 +117,9 @@ const getAdminRouter = (options: Partial<AdminJSOptions> = {}) => {
resource: { model: dmmf.modelMap.Annotation, client: prisma },
options: {
navigation: "Projects",
listProperties: ['Project', 'text', 'createdAt', 'User'],
filterProperties: ['Project', 'User'],
editProperties: ['text', "pause"],
actions: {
new: {
isAccessible: false,
Expand All @@ -142,6 +145,9 @@ const getAdminRouter = (options: Partial<AdminJSOptions> = {}) => {
resource: { model: dmmf.modelMap.Comment, client: prisma },
options: {
navigation: "Projects",
listProperties: ['Annotation', 'text', 'createdAt', 'User'],
filterProperties: ['User', 'Annotation'],
editProperties: ['text'],
actions: {
new: {
isAccessible: false,
Expand Down
10 changes: 7 additions & 3 deletions packages/client/src/components/SigninMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,14 @@ export const SigninMenu = ({
anchorEl={anchorEl}
open={open}
onClose={handleClose}
MenuListProps={{
"aria-labelledby": "basic-button",
}}
>
{user && user.role == "Admin" ? (
<a href={"/admin"} target="_blank" rel="noopener noreferrer">
<MenuItem>
<Trans i18nKey={"menu.admin"} />
</MenuItem>
</a>
) : null}
<MenuItem onClick={handleLogout}>
<Trans i18nKey={"menu.logout"} />
</MenuItem>
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/locales/en/common.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"about.intro.prefix":"The development of Celluloid","about.intro.suffix":"is led by Michaël Bourgatte and Laurent Tessier within a multidisciplinary Huma-Num Consortium gathering researchers mobilizing audiovisual corpora. ","about.opensource.github":"Celluloid is an Open Source project in Digital Humanities. The code and the instructions for use are freely available on GitHub.","about.opensource.prefix":"The version 2.0, \"Alphaville\", as well as its successive developments, are realized within the framework of the consortium Huma-Num CANEVAS (within the Maison des Sciences de l'Homme Paris Nord). This version is developed by Younès Benomar.","about.support":"Version 1.0 of Celluloid, \"Pierrot\", as well as its successive developments, were supported by the Catholic University of Paris, Saint Matthieu Foundation and La Paillasse projects incubator. This version was developed by Erwan Queffélec with the participation of Jean-Frédéric Bruzek, Souleymane Thiam and Guillaume Aichhorn.","about.title":"About","annotation.commentLabel":"{{count}} comment","annotation.commentLabel_one":"__TO_TRANSLATE__","annotation.commentLabel_other":"__TO_TRANSLATE__","annotation.commentLabel_plural":"{{count}} comments","annotation.commentPlaceholder":"Leave a comment…","annotation.contentPlaceholder":"type in your annotation…","annotation.hintLabel":"{{count}} annotation","annotation.hintLabel_one":"__TO_TRANSLATE__","annotation.hintLabel_other":"__TO_TRANSLATE__","annotation.hintLabel_plural":"{{count}} annotations","annotation.hintLabelNone":"No annotation at this time","annotation.pauseLabel":"Pause video ?","cancelAction":"Cancel","createAction":"Save","deleteAction":"Delete","footer.copyright":"© 2023 Consortium Canevas","footer.legalNotice":"Legal notice","footer.termsAndConditions":"Terms & Conditions","home.addVideo":"Add a link to a PeerTube video...","home.description":"Share a PeerTube video with your students, \n your pupils or your training groups: create your \n educational project, annotate the video frames, \n ask questions, provide the answers.","home.emptySearchResult":"No matching projects","home.joinProject":"join a project","home.myProjects":"My projects","home.newProject":"Create project","home.publicProjects":"Explore","home.searchProject":"Type anything…","home.students":"Pupils & Students","home.teachers":"Teachers & Trainers","home.title":"Learning together with a video","home.tutoriel.description":"","home.tutoriel.prefix":"To discover the application, you can consult the ","home.tutoriel.suffix":"tutorial ","home.tutoriel.title":"","levels.elementarySchool1":"Elementary school 1","levels.elementarySchool2":"Elementary school 2","levels.higherEducation":"Higher education","levels.highSchool":"High school","levels.kinderGarten":"Kindergarten","levels.middleSchool":"Middle school","levels.research":"Research","menu.about":"about","menu.create":"Create tag","menu.explore":"Explore","menu.join":"Join","menu.login":"login","menu.signup":"signup","notFound.action":"back to home","notFound.description":"The page you are looking for might be private or \n may have been deleted","notFound.title":"Page not found :(","printAction":"Print","project.assignment":"Assignment","project.assignmentPlaceholder":"Add an assignment","project.assignmentsHelper":"List the assignments submitted to the attendees","project.assignmentsSection":"Assignments","project.cancelAction":"Cancel","project.codeWarning.description":"This code will be available on the project page.\n To reset it, just reshare the project.","project.codeWarning.title":"Share this code with your students. ","project.collaborative":"Collaborative","project.collaborativeHelper":"Attendees to a collaborative project will be allowed to annotate or comment the video. If your project is not collaborative, only you can annotate and comment on it.","project.confirm-delete.description":"Are you sure ?","project.confirm-delete.title":"Delete project","project.createAction":" Create project","project.createTitle":"New project","project.creatorRole":"Creator","project.description":"Description","project.descriptionHelper":"Briefly describe your video","project.edit":"Edit","project.levelsHelper":"Select the education levels relevant to your project","project.levelsSection":"Education levels","project.members":"{{ count }} attendees","project.members_one":"an attendant","project.members_other":"{{ count }} attendees","project.members_plural":"{{ count }} attendees","project.objective":"Objective","project.objectiveHelper":"Choose an educational objective","project.public":"Public","project.publicHelper":"A public project will be visible by all users, even logged-out. However, they won't be able to see the annotations and comments, nor to add their own.","project.share.dialog.description":"To open printable instructions in a new widow ","project.share.dialog.linkText":"click here","project.share.guide.step1":"Open the web page","project.share.guide.step2":"On the landing page, click 'JOIN PROJECT'","project.share.guide.step3":"Enter the project code","project.share.guide.step4":"Enter your username and an answer to a secret question","project.share.guide.step5":"Make sure to read carefully the objective and assignments!","project.share.guide.step6":"Complete the assignments and annotate the video while it's playing!","project.share.guide.subtitle":"How to use Celluloid ?","project.share.guide.title":"Instructions","project.shared":"Share","project.tagsHelper":"Choose up to 4 tags that fit your project","project.tagsPlaceholder":"Search or create tag…","project.tagsSection":"Tags","project.title":"Title","project.titleHelper":"Choose a meaningful title for your project","project.URL_title":"Video URL","project.videoUrlHelper":"Link to the original video","project.visibilitySection":"Visibility","search.placeholder":"Search projet","shareAction":"Share","signin.alreadyRegistered":"Already registered?","signin.changePasswordAction":"reset password","signin.code":"Confirmation code","signin.codeHelper":"This code was sent to you by email","signin.confirmPassword":"Confirm password","signin.confirmSignupAction":"confirm signup","signin.confirmSignupTitle":"Confirm Signup","signin.email":"Email address","signin.forgotPasswordAction":"forgot password","signin.forgotPasswordTitle":"Forgot password","signin.joinAction":"join","signin.joinProjectTitle":"Join project","signin.lastName":"Last name","signin.login":"Email or username","signin.loginAction":"Login","signin.loginTitle":"Login","signin.notRegistered":"Not registered?","signin.password":"Password","signin.passwordHelper":"Minimum 8 characters","signin.passwordMismatch":"Confirmation doesn't match password","signin.projectCode":"Project code","signin.rememberlastName":"Your last name will serve as your login password","signin.resendCodeAction":"resend code","signin.resetAction":"reset","signin.signupAction":"signup","signin.signupOrLoginMessage":"Please signup or login to continue","signin.signupTitle":"Signup","signin.upgradeAccountMessage":"Please enter a valid email and a password to continue","signin.username":"Fisrtname or Username","tagSearch.createLabel":"Create tag","tagSearch.prefix":"Tag","update.action":"Refresh","update.message":"This app was just updated! Please refresh the page.","home.tutoriel.link":"","home.tutoriel.subtitle":"","menu.logout":"Logout","project.create.url.not-valid":"The provided URL is not valid. Please check and try again.","project.create.url.required":"URL is required. Please provide a valid URL.","project.create.error.video-info-failed":"Failed to retrieve video information. Please check the URL and try again.","ERR_ALREADY_EXISTING_PROJECT":"A project with the same title already exists, please rename the project","ERR_UNKOWN":"An unknown error has occurred. Please try again later or contact support for assistance.","project.keywords":"keywords"}
{"about.intro.prefix":"The development of","about.intro.suffix":"is led by Michaël Bourgatte and Laurent Tessier within a multidisciplinary Huma-Num Consortium gathering researchers mobilizing audiovisual corpora. ","about.opensource.github":"Celluloid is an Open Source project in Digital Humanities. The code and the instructions for use are freely available on GitHub.","about.opensource.prefix":"The version 2.0, \"Alphaville\", as well as its successive developments, are realized within the framework of the consortium Huma-Num CANEVAS (within the Maison des Sciences de l'Homme Paris Nord). This version is developed by Younès Benomar.","about.support":"Version 1.0 of Celluloid, \"Pierrot\", as well as its successive developments, were supported by the Catholic University of Paris, Saint Matthieu Foundation and La Paillasse projects incubator. This version was developed by Erwan Queffélec with the participation of Jean-Frédéric Bruzek, Souleymane Thiam and Guillaume Aichhorn.","about.title":"About","annotation.commentLabel":"{{count}} comment","annotation.commentLabel_one":"__TO_TRANSLATE__","annotation.commentLabel_other":"__TO_TRANSLATE__","annotation.commentLabel_plural":"{{count}} comments","annotation.commentPlaceholder":"Leave a comment…","annotation.contentPlaceholder":"type in your annotation…","annotation.hintLabel":"{{count}} annotation","annotation.hintLabel_one":"__TO_TRANSLATE__","annotation.hintLabel_other":"__TO_TRANSLATE__","annotation.hintLabel_plural":"{{count}} annotations","annotation.hintLabelNone":"No annotation at this time","annotation.pauseLabel":"Pause video ?","cancelAction":"Cancel","createAction":"Save","deleteAction":"Delete","ERR_ALREADY_EXISTING_PROJECT":"A project with the same title already exists, please rename the project","ERR_UNKOWN":"An unknown error has occurred. Please try again later or contact support for assistance.","footer.copyright":"CC BY-NC 2023 Consortium Canevas","footer.legalNotice":"Legal notice","footer.termsAndConditions":"Terms & Conditions","home.addVideo":"Add a link to a PeerTube video...","home.description":"A webservice to annotate, comment and analyze audiovisual content (movies, series, TV shows or your own videos – interviews, ethnographic documentary…), alone or as a team","home.emptySearchResult":"No matching projects","home.joinProject":"join a project","home.myProjects":"My projects","home.newProject":"Create project","home.publicProjects":"Explore","home.searchProject":"Type anything…","home.students":"","home.teachers":"","home.title":"What is Celluloid ?","home.tutoriel.description":"Go to Peertube\nChoose a video or upload a new one\nCopy the link to share the video\nCreate your project in Celluloid, copy the video link and go!\nWant to work with others? Share the project code with your partners","home.tutoriel.link":"The tutorial is here: <2>https://celluloid.hypotheses.org/1365</2>","home.tutoriel.prefix":"To discover the application, you can consult the ","home.tutoriel.subtitle":"You want to know more or you encounter difficulties?","home.tutoriel.suffix":"tutorial ","home.tutoriel.title":"How to use Celluloid ?","levels.elementarySchool1":"","levels.elementarySchool2":"","levels.higherEducation":"","levels.highSchool":"","levels.kinderGarten":"","levels.middleSchool":"","levels.research":"","menu.about":"about","menu.admin":"Admin","menu.create":"Create tag","menu.explore":"Explore","menu.join":"Join","menu.login":"login","menu.logout":"Logout","menu.signup":"signup","notFound.action":"back to home","notFound.description":"The page you are looking for might be private or \n may have been deleted","notFound.title":"Page not found :(","printAction":"Print","project.assignment":"Task","project.assignmentPlaceholder":"Add a task","project.assignmentsHelper":"List the tasks you submitt to the attendees","project.assignmentsSection":"Tasks","project.cancelAction":"Cancel","project.codeWarning.description":"This code will be available on the project page.\n To reset it, just reshare the project.","project.codeWarning.title":"Share this code with the participants","project.collaborative":"Collaborative","project.collaborativeHelper":"Attendees to a collaborative project will be allowed to annotate or comment the video. If your project is not collaborative, only you can annotate and comment on it.","project.confirm-delete.description":"Are you sure ?","project.confirm-delete.title":"Delete project","project.create.error.video-info-failed":"Failed to retrieve video information. Please check the URL and try again.","project.create.url.not-valid":"The provided URL is not valid. Please check and try again.","project.create.url.required":"URL is required. Please provide a valid URL.","project.createAction":"Create project","project.createTitle":"New project","project.creatorRole":"Creator","project.description":"Description","project.descriptionHelper":"Briefly describe your video","project.edit":"Edit","project.keywords":"keywords","project.levelsHelper":"","project.levelsSection":"","project.members":"{{ count }} attendees","project.members_one":"an attendant","project.members_other":"{{ count }} attendees","project.members_plural":"{{ count }} attendees","project.objective":"Objective","project.objectiveHelper":"Choose an objective","project.public":"Public","project.publicHelper":"A public project will be visible by all users, even logged-out. However, they won't be able to see the annotations and comments, nor to add their own.","project.share.dialog.description":"To open printable instructions in a new widow ","project.share.dialog.linkText":"click here","project.share.guide.step1":"Open the web page","project.share.guide.step2":"On the landing page, click 'JOIN PROJECT'","project.share.guide.step3":"Enter the project code","project.share.guide.step4":"Enter your username and an answer to a secret question","project.share.guide.step5":"Make sure to read carefully the objective and assignments","project.share.guide.step6":"Complete the assignments and annotate the video while it's playing","project.share.guide.subtitle":"How to use Celluloid ?","project.share.guide.title":"Instructions","project.shared":"Share","project.tagsHelper":"","project.tagsPlaceholder":"","project.tagsSection":"","project.title":"Title","project.titleHelper":"Choose a meaningful title for your project","project.URL_title":"Video URL","project.videoUrlHelper":"Link to the original video","project.visibilitySection":"Visibility","search.placeholder":"Search projet","shareAction":"Share","signin.alreadyRegistered":"Already registered?","signin.changePasswordAction":"reset password","signin.code":"Confirmation code","signin.codeHelper":"This code was sent to you by email","signin.confirmPassword":"Confirm password","signin.confirmSignupAction":"confirm signup","signin.confirmSignupTitle":"Confirm Signup","signin.email":"Email address","signin.forgotPasswordAction":"forgot password","signin.forgotPasswordTitle":"Forgot password","signin.joinAction":"join","signin.joinProjectTitle":"Join project","signin.lastName":"Last name","signin.login":"Email or username","signin.loginAction":"Login","signin.loginTitle":"Login","signin.notRegistered":"Not registered?","signin.password":"Password","signin.passwordHelper":"Minimum 8 characters","signin.passwordMismatch":"Confirmation doesn't match password","signin.projectCode":"Project code","signin.rememberlastName":"Your last name will serve as your login password","signin.resendCodeAction":"resend code","signin.resetAction":"reset","signin.signupAction":"signup","signin.signupOrLoginMessage":"Please signup or login to continue","signin.signupTitle":"Signup","signin.upgradeAccountMessage":"Please enter a valid email and a password to continue","signin.username":"Fisrtname or Username","tagSearch.createLabel":"Create tag","tagSearch.prefix":"Tag","update.action":"Refresh","update.message":"This app was just updated! Please refresh the page."}
Loading

0 comments on commit fdcf124

Please sign in to comment.