Skip to content
Open
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
14 changes: 3 additions & 11 deletions components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,9 @@ import Link from "next/link";
import { useTranslation } from "react-i18next";
import { getAgoraeConfig } from "../services/Config";
import Head from "next/head";
import { setCookie,getCookie } from "@services/utils";
import { setCookie,getCookie, getusernamepass } from "@services/utils";


function getusername(){
let username;
try{
username=getCookie("agoraeUser");
}catch{
username="";
}
return username;
}
function Header(props) {
const { t, i18n } = useTranslation();
const config = getAgoraeConfig();
Expand Down Expand Up @@ -99,7 +91,7 @@ function Header(props) {
<Link href="/login">
<a>
{t("header.Login")}
<Soon>{getusername()}</Soon>
<Soon>{getusernamepass()[0]}</Soon>
</a>
</Link>
<Link href="">
Expand Down
23 changes: 22 additions & 1 deletion components/ItemElement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,19 @@ import Link from "next/link";
import Image from "next/image";
import { motion, AnimatePresence } from "framer-motion"
import PreviewRender from "./UI/PreviewRender";
import HyperTopic from "@services/HyperTopic";
import { getAgoraeConfig } from "@services/Config";
import { setCookie,getCookie, getusernamepass } from "@services/utils";
import { deleteItem } from "@services/Edituitls";

function ItemElement({ title, preview, creator, description, id, creation_date, corpus_id }) {
const { t, i18n } = useTranslation();
let hidden = false;
let user=getusernamepass()[0];
if(user==="Login" || user ===""){
hidden = true;
}
return (

<ElementBox
as={motion.div}
initial={{ opacity: 0 }}
Expand Down Expand Up @@ -37,6 +45,9 @@ function ItemElement({ title, preview, creator, description, id, creation_date,
<a>{t("item_element.more_details")}</a>
</Link>
</Button>
<Delete hidden={hidden} onClick={()=>{deleteItem(id)}}>
Delete
</Delete>
</Bottom>
</ElementBox>
);
Expand Down Expand Up @@ -112,4 +123,14 @@ const Button = styled.div`
cursor: pointer;
}
`;
const Delete = styled.div`
padding: 15px;
font-weight: bold;
color: #ffffff;
background:linear-gradient(to bottom, #0393f4 5%, #3f51b5 100%);

&:hover {
cursor: pointer;
}
`;
export default ItemElement;
2 changes: 1 addition & 1 deletion config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const configFile = {
"6cc411d06b5890af3601957b5d015025",
],
home_corpus: ["2ba774a7cbd1e14fa45e57ba0000fa79"], // can be * if you want to use all available corpuses
available_viewpoints: ["2ba774a7cbd1e14fa45e57ba00010f15"],
available_viewpoints: ["2ba774a7cbd1e14fa45e57ba00010f15","2ba774a7cbd1e14fa45e57ba000109cb"],
order: "",
},
};
Expand Down
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
},
"dependencies": {
"formik": "^2.2.9",
"fortawesome": "0.0.1-security",
"framer-motion": "^5.4.5",
"hypertopic": "^3.6.0",
"i18next": "^21.3.3",
Expand Down
13 changes: 10 additions & 3 deletions pages/corpus/[corpusID]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { useRouter } from "next/router";
import React, { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import styled from "styled-components";
import { setCookie,getCookie, getusernamepass } from "@services/utils";
import { addItemtoCorpus } from "@services/Edituitls";

function Corpus() {
const { t, i18n } = useTranslation();
Expand Down Expand Up @@ -56,6 +58,7 @@ function Corpus() {
}
}, [localPage, corpusID]);


function renderElements() {
if (isLoading) {
return (
Expand All @@ -64,6 +67,11 @@ function Corpus() {
</ElementsList>
);
} else {
let a =document.getElementById("addbutton");
let user=getusernamepass()[0];
if(user==="Login" || user ===""){
a.style.display="none";
}
return (
<AnimatePresence>
<div style={{ top: "-120px", position: "relative" }}>
Expand Down Expand Up @@ -91,7 +99,7 @@ function Corpus() {
<Layout title={"Corpus : " + corpusMetaData.corpus_name}>
<Hero>
<h1>{corpusMetaData.corpus_name}</h1>
<a href="#">Add item</a>
<a href="#" id="addbutton" onClick={()=>{ addItemtoCorpus(corpusMetaData.corpus_id)}}>Add item</a>
</Hero>
<br />
{renderElements()}
Expand Down Expand Up @@ -122,6 +130,7 @@ const Hero = styled.div`
background-image: linear-gradient(39deg, ${config.website.colors[0]}, ${config.website.colors[1]});
height: 250px;


h1 {
padding-top: 10px;
margin-bottom: 0px;
Expand Down Expand Up @@ -154,7 +163,5 @@ const Hero = styled.div`
position:relative;
top:1px;
}


`;
export default Corpus;
Loading