Skip to content
Snippets Groups Projects
Commit 0d5a2d30 authored by RichardHeise's avatar RichardHeise
Browse files

Issue #90: FIX modal colectable

parent b7f8c6ca
Branches
No related tags found
1 merge request!67Issue #90: FIX modal colectable
Pipeline #37224 passed
......@@ -17,7 +17,7 @@ export default function Overlay({
setTitlePage,
setNewSize,
}) {
const [openMenu, setOpenMenu] = useState(true);
const [openMenu, setOpenMenu] = useState(false);
const handleOpenMenu = () => {
setOpenMenu(!openMenu);
};
......
......@@ -4,12 +4,11 @@ import Link from "next/link";
import CollectionsBookmarkIcon from "@mui/icons-material/CollectionsBookmark";
import SubjectIcon from "@mui/icons-material/Subject";
import LocalLibraryIcon from "@mui/icons-material/LocalLibrary";
import PeopleAltIcon from "@mui/icons-material/PeopleAlt";
import HelpIcon from "@mui/icons-material/Help";
import { useEffect, useState } from "react";
import mecredApi from "@/axiosConfig";
import VerifiedIcon from "@mui/icons-material/Verified";
import { usePathname, useSearchParams, useRouter } from "next/navigation";
import { usePathname, useRouter } from "next/navigation";
const acessoRapido = [
{
......@@ -35,29 +34,6 @@ const acessoRapido = [
},
];
const atalhos = [
{
title: "Relevantes",
order: "score",
},
{
title: "Recentes",
order: "publicationdesc",
},
{
title: "Favoritados",
order: "likes",
},
{
title: "Baixados",
order: "downloads",
},
{
title: "Alfabética",
order: "title",
},
];
function handleStringSubject(array) {
let string = "";
......@@ -68,27 +44,11 @@ function handleStringSubject(array) {
return string.substring(0, string.length - 1);
}
function handleTranslateTitle(title) {
switch (title) {
case "score":
return "Relevantes";
case "publicationdesc":
return "Recentes";
case "likes":
return "Colecionados";
case "downloads":
return "Baixados";
case "title":
return "Alfabética";
}
}
export default function SideBar({ setFilterSubject, openMenu }) {
const [subjects, setSubjects] = useState([]);
const [selectedSubject, setSelectedSubject] = useState([]);
let pathname = usePathname();
const searchParams = useSearchParams();
const router = useRouter();
useEffect(() => {
......@@ -169,9 +129,6 @@ export default function SideBar({ setFilterSubject, openMenu }) {
key={index}
onClick={() => {
handleFilterSubject(index);
// const params = new URLSearchParams(searchParams)
// params.set("subjects", filterSubject);
// router.push("/learningObjects?" + params.toString());
}}
>
<LocalLibraryIcon
......
import { useEffect } from 'react';
import { useRouter } from 'next/router';
function useCustomFetch(url, options, onDataReceived) {
const router = useRouter();
useEffect(() => {
const fetchData = async () => {
try {
const response = await fetch(url, options);
if (response.status === 401) {
// Redirect to the main page or login page
router.push('/');
} else {
// Continue processing the response
const data = await response.json();
// Run the provided callback on the received data
if (typeof onDataReceived === 'function') {
onDataReceived(data);
}
// Add your logic to handle the successful response here
}
} catch (error) {
console.error('Error processing request:', error);
// Add your logic to handle errors here
}
};
fetchData();
}, [url, options, router, onDataReceived]);
// You can return additional data or state here if needed
}
\ No newline at end of file
......@@ -4,6 +4,6 @@ import { redirect } from 'next/navigation'
export default function Home() {
return (
redirect('/collections')
redirect('/about')
);
}
......@@ -51,6 +51,7 @@ export default function GroupButton({ profileData, idLogin }) {
setFollow(profileData.followed)
}, [profileData.followed])
// Report function
// useEffect(() => {
// if (!isLoggedIn()) return;
......@@ -74,11 +75,6 @@ export default function GroupButton({ profileData, idLogin }) {
// });
// }, [client, token, uid, profileData]);
return (
<div className=''>
......
......@@ -26,8 +26,6 @@ function ChangeOnHover({ text, textOnHover }) {
}
export default function ActionButtons({ learningObject, setNeedLoginOpen }) {
const loginBarrier = useLoginBarrier();
const [liked, setLiked] = useState(learningObject.liked);
const [shareOpen, setShareOpen] = useState(false);
......
......@@ -88,7 +88,7 @@ export default function CollectModal({ open, onClose, idLogin, resourceId }) {
className=" text-sm p-2 w-[20%] text-main-text border-main rounded-lg normal-case h-9 font-bold bg-main hover:bg-main-hover"
onClick={() => onClose()}
>
Cancelar
Ok
</button>
</div>
......@@ -105,7 +105,7 @@ export default function CollectModal({ open, onClose, idLogin, resourceId }) {
className=" text-sm p-2 w-[20%] text-main-text border-main rounded-lg normal-case h-9 font-bold bg-main hover:bg-main-hover"
onClick={() => onClose()}
>
Cancelar
Ok
</button>
</div>
......@@ -121,7 +121,7 @@ export default function CollectModal({ open, onClose, idLogin, resourceId }) {
onClose={onClose}
className="grid place-items-center"
>
<div className="flex flex-col w-[80%] bg-main p-5 md:w-[40%] h-[40%] -mt-[60%] sm:h-[60%] sm:-mt-[30%] md:-mt-[20%] xl:-mt-[10%] rounded-lg min-h-[250px] ">
<div className="flex flex-col w-[80%] bg-main p-5 md:w-[50%] h-[40%] -mt-[60%] sm:h-[70%] max-sm:h-[70%] max-sm:-mt-[25%] sm:-mt-[30%] md:-mt-[20%] xl:-mt-[0%] rounded-lg min-h-[250px] ">
<ModalRepeat open={repeatedOpen} onClose={() => { setRepeatedOpen(false) }} />
<ModalSucess open={sucessOpen} onClose={() => { setSucessOpen(false) }} />
<p className="text-2xl font-bold text-main-text">Guardar Recurso</p>
......@@ -164,7 +164,7 @@ export default function CollectModal({ open, onClose, idLogin, resourceId }) {
className="text-sm p-2 w-[20%] text-main-text border-main rounded-lg normal-case h-9 font-bold bg-main hover:bg-main-hover"
onClick={() => onClose()}
>
Cancelar
Fechar
</button>
</div>
</div>
......
import { Avatar, Button, Paper } from "@mui/material";
import { useLoginBarrier } from "@/app/handlers/loginHandler";
import Image from "next/image";
import { useState, useEffect } from "react";
import mecredApi from "@/axiosConfig";
import { getStoredValue } from "@/app/handlers/localStorageHandler";
export default function PublisherInfo({ publisher }) {
const [followed, setFollowed] = useState(false);
const loginBarrier = useLoginBarrier();
const token = getStoredValue("access_token")
const client = getStoredValue("client")
......@@ -14,7 +14,7 @@ export default function PublisherInfo({ publisher }) {
const expiry = getStoredValue("expiry")
useEffect(() => {
setFollowed(publisher?.followed ?? "false");
setFollowed(publisher?.followed ?? false);
}, [publisher]);
if (!publisher) {
......@@ -56,11 +56,9 @@ export default function PublisherInfo({ publisher }) {
<div className="font-bold text-lg truncate sm:text-wrap">
{publisher.name}
</div>
{/*
Retorna <p> desconhecido <p/> em alguns casos
<div className="font-normal text-md truncate">
{publisher.description}
</div> */}
</div>
</div>
<div className="flex justify-end flex-grow flex-shrink-0 p-3 truncate">
<Button
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment