Skip to content

Commit

Permalink
Merge pull request #128 from AI4Bharat/btns
Browse files Browse the repository at this point in the history
guest_workspace
  • Loading branch information
aparna-aa authored Jun 18, 2024
2 parents 63bb270 + 99cf2aa commit 9eef634
Show file tree
Hide file tree
Showing 19 changed files with 1,352 additions and 205 deletions.
314 changes: 307 additions & 7 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"dotenv": "^16.4.5",
"firebase": "^10.7.1",
"firebase-auth": "^0.1.2",
"franc-min": "^6.2.0",
"html-react-parser": "^5.1.10",
"html2canvas": "^1.4.1",
"install": "^0.13.0",
Expand All @@ -46,12 +47,15 @@
"react-json-tree": "^0.18.0",
"react-markdown": "^9.0.1",
"react-material-ui-carousel": "^3.4.2",
"react-media-recorder": "^1.6.6",
"react-quill": "^2.0.0",
"react-quilljs": "^1.3.3",
"react-redux": "^9.0.4",
"react-router-dom": "^6.21.2",
"react-speech-recognition": "^3.10.0",
"react-syntax-highlighter": "^15.5.0",
"recharts": "^2.12.0"
"recharts": "^2.12.0",
"regenerator-runtime": "^0.14.1"
},
"devDependencies": {
"autoprefixer": "^10.4.16",
Expand Down
47 changes: 47 additions & 0 deletions src/app/actions/api/Projects/EditGuestWorkspace.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
* Login API
*/
import API from "../../api";
import ENDPOINTS from "../../../../config/apiendpoint"
import constants from "../../constants";

export default class EditGuestWorkspace extends API {
constructor(workspaceId,workspacePassword ,timeout = 2000) {
super("PATCH", timeout, false);
this.workspace_password = workspacePassword
this.type = constants.ARCHIVE_WORKSPACE;
this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.getWorkspaces}${workspaceId}/edit_workspace/`;
}

processResponse(res) {
super.processResponse(res);
if (res) {
this.editworkspace= res;
}
}

apiEndPoint() {
return this.endpoint;
}

getBody() {
return {
workspace_password:this.workspace_password,
}
}


getHeaders() {
this.headers = {
headers: {
"Content-Type": "application/json",
"Authorization": `JWT ${localStorage.getItem('anudesh_access_token')}`
},
};
return this.headers;
}

getPayload() {
return this.archiveworkspace;
}
}
46 changes: 46 additions & 0 deletions src/app/actions/api/Projects/EditWorkspace.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/**
* Login API
*/
import API from "../../api";
import ENDPOINTS from "../../../../config/apiendpoint"
import constants from "../../constants";

export default class EditWorkspace extends API {
constructor(workspaceId, timeout = 2000) {
super("PATCH", timeout, false);
this.type = constants.ARCHIVE_WORKSPACE;
this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.getWorkspaces}${workspaceId}/edit_workspace/`;
}

processResponse(res) {
super.processResponse(res);
if (res) {
this.editworkspace= res;
}
}

apiEndPoint() {
return this.endpoint;
}

getBody() {
return {
guest_workspace: false
}
}


getHeaders() {
this.headers = {
headers: {
"Content-Type": "application/json",
"Authorization": `JWT ${localStorage.getItem('anudesh_access_token')}`
},
};
return this.headers;
}

getPayload() {
return this.archiveworkspace;
}
}
48 changes: 48 additions & 0 deletions src/app/actions/api/Projects/createWorkspace.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* Login API
*/
import API from "../../api";
import ENDPOINTS from "../../../../config/apiendpoint"
import constants from "../../constants";

export default class CreateGuestWorkspace extends API {
constructor(workspaceId,workspacePassword ,timeout = 2000) {
super("PATCH", timeout, false);
this.workspace_password = workspacePassword
this.type = constants.ARCHIVE_WORKSPACE;
this.endpoint = `${super.apiEndPointAuto()}${ENDPOINTS.getWorkspaces}${workspaceId}/edit_workspace/`;
}

processResponse(res) {
super.processResponse(res);
if (res) {
this.editworkspace= res;
}
}

apiEndPoint() {
return this.endpoint;
}

getBody() {
return {
workspace_password:this.workspace_password,
guest_workspace: true
}
}


getHeaders() {
this.headers = {
headers: {
"Content-Type": "application/json",
"Authorization": `JWT ${localStorage.getItem('anudesh_access_token')}`
},
};
return this.headers;
}

getPayload() {
return this.archiveworkspace;
}
}
1 change: 1 addition & 0 deletions src/app/page.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"use client";
// import 'regenerator-runtime/runtime'
import RootLayout from "./layout";
import Home from "./ui/pages/home/home"
import { HashRouter, Route, Routes, Navigate } from "react-router-dom"
Expand Down
20 changes: 18 additions & 2 deletions src/app/ui/pages/chat/AnnotatePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,7 @@ const AnnotatePage = () => {
</span>
}
>
<Button
{ProjectDetails.project_type=="InstructionDrivenChat"?<Button
value="Clear Chats"
type="default"
variant="outlined"
Expand All @@ -1030,7 +1030,23 @@ const AnnotatePage = () => {
}}
>
Clear Chats
</Button>
</Button>:<Button
value="Reset All Forms"
type="default"
variant="outlined"
onClick={() =>
handleAnnotationClick("delete", Annotation.id, Annotation.lead_time)
}
style={{
minWidth: '150px',
color: 'black',
borderRadius: '5px',
border: '0px',
paddingTop: 2,
paddingBottom: 2,
backgroundColor: '#ffe0b2',
}}
> Reset All</Button>}
</Tooltip>
</Grid>
)}
Expand Down
6 changes: 4 additions & 2 deletions src/app/ui/pages/home/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import "./home.css";
import { useEffect } from "react";
import Image from "next/image";
import { useNavigate } from "react-router-dom";
import { Link, useNavigate } from "react-router-dom";
import ChatIcon from "@mui/icons-material/Chat";
import IntegrationInstructionsIcon from "@mui/icons-material/IntegrationInstructions";
import RateReviewIcon from "@mui/icons-material/RateReview";
Expand Down Expand Up @@ -165,9 +165,11 @@ const Home = () => {
{banner.subheading}
</div>
<div className="flex gap-8">
<button className="bg-orange-600 text-white text-xl p-4 rounded-md hover:bg-white hover:text-orange-600 border border-orange-600">
<Link to={"https://www.youtube.com/playlist?list=PL9n2cBQBp3vyZ3JOcGzYbRKMgaW2PtTJ4"}>
<button className="bg-orange-600 text-white text-xl p-4 rounded-md hover:bg-white hover:text-orange-600 border border-orange-600">
{banner.demo}
</button>
</Link>

<button
onClick={() => navigate("/login")}
Expand Down
Loading

0 comments on commit 9eef634

Please sign in to comment.