mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
fix: user avatar editor
This commit is contained in:
parent
2995c8ec84
commit
fec4437e0a
4 changed files with 14 additions and 14 deletions
|
|
@ -15,7 +15,7 @@ function Element(props: any) {
|
||||||
<a target="_blank" rel="noopener noreferrer"> <EyeOpenIcon/></a>
|
<a target="_blank" rel="noopener noreferrer"> <EyeOpenIcon/></a>
|
||||||
</Link>
|
</Link>
|
||||||
<Link href={`/org/${props.orgslug}/course/${props.courseid}/element/${props.element.id.replace("element_", "")}/edit`}>
|
<Link href={`/org/${props.orgslug}/course/${props.courseid}/element/${props.element.id.replace("element_", "")}/edit`}>
|
||||||
<a target="_blank" rel="noopener noreferrer"> <Pencil2Icon/></a>
|
<a rel="noopener noreferrer"> <Pencil2Icon/></a>
|
||||||
</Link>
|
</Link>
|
||||||
</ElementWrapper>
|
</ElementWrapper>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,6 @@ interface Editor {
|
||||||
|
|
||||||
function Editor(props: Editor) {
|
function Editor(props: Editor) {
|
||||||
const auth: any = React.useContext(AuthContext);
|
const auth: any = React.useContext(AuthContext);
|
||||||
console.log(props.element);
|
|
||||||
console.log(props.course);
|
|
||||||
|
|
||||||
const editor: any = useEditor({
|
const editor: any = useEditor({
|
||||||
extensions: [
|
extensions: [
|
||||||
|
|
@ -53,7 +51,7 @@ function Editor(props: Editor) {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<motion.div
|
<motion.div
|
||||||
initial={{ opacity: 0, scale: 0.9 }}
|
initial={{ opacity: 0, scale: 0.98 }}
|
||||||
animate={{ opacity: 1, scale: 1 }}
|
animate={{ opacity: 1, scale: 1 }}
|
||||||
key="modal"
|
key="modal"
|
||||||
transition={{
|
transition={{
|
||||||
|
|
@ -83,13 +81,14 @@ function Editor(props: Editor) {
|
||||||
</EditorDocSection>
|
</EditorDocSection>
|
||||||
<EditorUsersSection>
|
<EditorUsersSection>
|
||||||
<EditorUserProfileWrapper>
|
<EditorUserProfileWrapper>
|
||||||
<Avvvatars value={auth.userInfo.user_object.user_id} style="shape" />
|
{!auth.isAuthenticated && <span>Loading</span>}
|
||||||
|
{auth.isAuthenticated && <Avvvatars value={auth.userInfo.user_object.user_id} style="shape" />}
|
||||||
</EditorUserProfileWrapper>
|
</EditorUserProfileWrapper>
|
||||||
</EditorUsersSection>
|
</EditorUsersSection>
|
||||||
</EditorTop>
|
</EditorTop>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
<motion.div
|
<motion.div
|
||||||
initial={{ opacity: 0, scale: 0.9 }}
|
initial={{ opacity: 0, scale: 0.99 }}
|
||||||
animate={{ opacity: 1, scale: 1 }}
|
animate={{ opacity: 1, scale: 1 }}
|
||||||
key="modal"
|
key="modal"
|
||||||
transition={{
|
transition={{
|
||||||
|
|
|
||||||
|
|
@ -12,15 +12,16 @@ export interface Auth {
|
||||||
isLoading: boolean;
|
isLoading: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const AuthProvider = (props: any) => {
|
const AuthProvider = (props: any) => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [auth, setAuth] = React.useState<Auth>({ access_token: "", isAuthenticated: false, userInfo: {}, isLoading: true });
|
const [auth, setAuth] = React.useState<Auth>({ access_token: "", isAuthenticated: false, userInfo: {}, isLoading: true });
|
||||||
|
|
||||||
async function checkRefreshToken() {
|
async function checkRefreshToken() {
|
||||||
let data = await getRefreshToken();
|
let data = await getRefreshToken();
|
||||||
|
if (data) {
|
||||||
return data.access_token;
|
return data.access_token;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function checkAuth() {
|
async function checkAuth() {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import styled from "styled-components";
|
||||||
import { Header } from "../../../../../../components//UI/Header";
|
import { Header } from "../../../../../../components//UI/Header";
|
||||||
import Layout from "../../../../../../components//UI/Layout";
|
import Layout from "../../../../../../components//UI/Layout";
|
||||||
import { Title } from "../../../../../../components//UI/Elements/Styles/Title";
|
import { Title } from "../../../../../../components//UI/Elements/Styles/Title";
|
||||||
import { DragDropContext, Droppable, Draggable } from "react-beautiful-dnd";
|
import { DragDropContext, Droppable } from "react-beautiful-dnd";
|
||||||
import { initialData, initialData2 } from "../../../../../../components/Drags/data";
|
import { initialData, initialData2 } from "../../../../../../components/Drags/data";
|
||||||
import Chapter from "../../../../../../components/Drags/Chapter";
|
import Chapter from "../../../../../../components/Drags/Chapter";
|
||||||
import { createChapter, deleteChapter, getCourseChaptersMetadata, updateChaptersMetadata } from "../../../../../../services/courses/chapters";
|
import { createChapter, deleteChapter, getCourseChaptersMetadata, updateChaptersMetadata } from "../../../../../../services/courses/chapters";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue