Path again

This commit is contained in:
Kilian committed 2024-07-27 23:10:26 +02:00
1 parent 9d6bd65583
commit 72a0ad6364
9 files changed
+15 -10

No files matched your search

+1
View File
@@ -0,0 +1 @@
import{j as e,M as ue,a as U,T as v,B as w,b as F,c as C,A as Pe,d as oe,L as O,C as Q,I as M,e as Se,f as T,P as I,g as Fe,u as Ae,h as de,i as te,k as se,D as _,l as H,m as A,n as V,o as he,p as Ee,q as me,r as pe,s as $e,S as R,t as ke,G as y,v as ne,w as De,x as Te,y as Ie,z as Ue,F as Le,E as Oe,H as qe}from"./mui-CxHUbSMi.js";import{u as re,a as z,b as G,c as Me,d as Re,L as k,e as Be,O as Qe,f as ze,r as K,g as N,h as W,q as X,i as ae,j as B,Q as Ne,k as We,l as Ke,R as _e,m as He}from"./tanstack-xmxrKlZO.js";import{c as Ve,r as j}from"./react-DXd9vB-a.js";import{i as q,B as Ge,a as Xe,b as Ze,u as E,t as p}from"./i18n-DJgSTqOl.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))r(n);new MutationObserver(n=>{for(const i of n)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function o(n){const i={};return n.integrity&&(i.integrity=n.integrity),n.referrerPolicy&&(i.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?i.credentials="include":n.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(n){if(n.ep)return;n.ep=!0;const i=o(n);fetch(n.href,i)}})();var ee={},ie=Ve;ee.createRoot=ie.createRoot,ee.hydrateRoot=ie.hydrateRoot;const Y=15,Je=3,S="/phpCourse/exam/storage/",P="https://khofmann.userpage.fu-berlin.de/phpCourse/exam/api/";let le;class Ye{constructor(){if(this.userListeners=[],this.hasAuth=()=>this.token!==void 0,this.isAdmin=()=>{var s;return this.hasAuth()&&((s=this.self)==null?void 0:s.isAdmin)},this.getAuthenticatedUser=()=>this.self,this.getCurrentSession=()=>[this.token,this.refreshToken],this.subscribeToAuthenticatedUser=s=>(this.userListeners.push(s),()=>{this.userListeners=this.userListeners.filter(o=>o!==s)}),this.logIn=async(s,o)=>{const{user:r,token:n}=await(await this.post("login",{email:s,password:o})).json();this.self=r,this.token=n,this.userListeners.forEach(i=>i(r))},this.logOut=async()=>{try{return await(await this.postAuth("logout")).json()}catch{return!1}finally{this.self=void 0,this.token=void 0,this.userListeners.forEach(s=>s())}},this.posts=async s=>{const o=`posts?p=${s??0}&l=${Y}`;return this.token?await(await this.getAuth(o)).json():await(await this.get(o)).json()},this.deletePost=async s=>await(await this.delete(`posts/${s}?l=${Y}`)).json(),this.user=async s=>{var o;return await(await this.getAuth(`users/${s??((o=this.self)==null?void 0:o.id)}`)).json()},this.updateUser=async(s,o)=>{const r=await(await this.patch(`users/${o??"self"}`,s)).json();return this.self=r,this.userListeners.forEach(n=>n(r)),r},this.updateUserImage=async(s,o)=>{const r=new FormData;s.image&&r.append("image",s.image),!s.image&&s.predefined&&r.append("predefined",s.predefined);const n=await(await this.postAuthRaw(`users/${o??"self"}/image`,r)).json();return this.self=n,this.userListeners.forEach(i=>i(n)),n},this.newPost=async s=>await(await this.postAuth(`posts?l=${Y}`,{...s})).json(),this.updatePost=async(s,o)=>await(await this.patch(`posts/${o}`,s)).json(),this.userPosts=async s=>await(await this.getAuth(`users/${s}/posts?l=${Je}&s=desc`)).json(),this.post=async(s,o,r)=>{const n=await fetch(`${P}${s}`,{mode:"cors",method:"post",headers:r,body:JSON.stringify(o)});if(n.ok)return n;throw await n.json()},this.postAuth=async(s,o,r)=>{const n=await fetch(`${P}${s}`,{mode:"cors",method:"post",headers:{token:this.token??"",...r},body:JSON.stringify(o)});if(n.ok)return n;throw await n.json()},this.postAuthRaw=async(s,o,r)=>{const n=await fetch(`${P}${s}`,{mode:"cors",method:"post",headers:{token:this.token??"",...r},body:o});if(n.ok)return n;throw await n.json()},this.get=async(s,o)=>{const r=await fetch(`${P}${s}`,{mode:"cors",method:"get",headers:o});if(r.ok)return r;throw await r.json()},this.getAuth=async(s,o)=>{const r=await fetch(`${P}${s}`,{mode:"cors",method:"get",headers:{token:this.token??"",...o}});if(r.ok)return r;throw await r.json()},this.delete=async(s,o)=>{const r=await fetch(`${P}${s}`,{mode:"cors",method:"delete",headers:{token:this.token??"",...o}});if(r.ok)return r;throw await r.json()},this.patch=async(s,o,r)=>{const n=await fetch(`${P}${s}`,{mode:"cors",method:"patch",headers:{token:this.token??"",...r},body:JSON.stringify(o)});if(n.ok)return n;throw await n.json()},le)throw new Error("New instance cannot be created!!");le=this}}const h=new Ye;var D=(t=>(t.NOT_FOUND="NotFound",t.UNAUTHORIZED="Unauthorized",t.FAILED_UPDATE="FailedUpdate",t.MISSING_FIELD="MissingField",t))(D||{});q.use(Ge).use(Xe).use(Ze).init({fallbackLng:"en",debug:!1,interpolation:{escapeValue:!1},backend:{loadPath:"/phpCourse/exam/dist/locales/{{lng}}/{{ns}}.json"}});const et=({anchorEl:t,handleClose:s})=>e.jsxs(ue,{anchorEl:t,anchorOrigin:{vertical:"bottom",horizontal:"right"},keepMounted:!0,transformOrigin:{vertical:"top",horizontalLine truncated
-1
View File
@@ -1 +0,0 @@
import{j as e,M as ce,a as $,T as v,B as w,b as S,c as C,A as we,d as ae,L,C as B,I as q,e as Pe,f as T,P as I,g as Se,u as Fe,h as ue,i as ee,k as te,D as K,l as _,m as F,n as H,o as de,p as Ee,q as he,r as me,s as Ae,S as M,t as ke,G as y,v as se,w as De,x as Te,y as Ie,z as $e,F as Ue,E as Le,H as Oe}from"./mui-CxHUbSMi.js";import{u as ne,a as Q,b as V,c as qe,d as Me,L as k,e as Re,O as Be,f as Qe,r as W,g as z,h as N,q as G,i as re,j as R,Q as ze,k as Ne,l as We,R as Ke,m as _e}from"./tanstack-xmxrKlZO.js";import{c as He,r as j}from"./react-DXd9vB-a.js";import{i as O,B as Ve,a as Ge,b as Xe,u as E,t as p}from"./i18n-DJgSTqOl.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))r(n);new MutationObserver(n=>{for(const i of n)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function o(n){const i={};return n.integrity&&(i.integrity=n.integrity),n.referrerPolicy&&(i.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?i.credentials="include":n.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(n){if(n.ep)return;n.ep=!0;const i=o(n);fetch(n.href,i)}})();var Y={},oe=He;Y.createRoot=oe.createRoot,Y.hydrateRoot=oe.hydrateRoot;const J=15,Ze=3,P="https://khofmann.userpage.fu-berlin.de/phpCourse/exam/api/";let ie;class Je{constructor(){if(this.userListeners=[],this.hasAuth=()=>this.token!==void 0,this.isAdmin=()=>{var s;return this.hasAuth()&&((s=this.self)==null?void 0:s.isAdmin)},this.getAuthenticatedUser=()=>this.self,this.getCurrentSession=()=>[this.token,this.refreshToken],this.subscribeToAuthenticatedUser=s=>(this.userListeners.push(s),()=>{this.userListeners=this.userListeners.filter(o=>o!==s)}),this.logIn=async(s,o)=>{const{user:r,token:n}=await(await this.post("login",{email:s,password:o})).json();this.self=r,this.token=n,this.userListeners.forEach(i=>i(r))},this.logOut=async()=>{try{return await(await this.postAuth("logout")).json()}catch{return!1}finally{this.self=void 0,this.token=void 0,this.userListeners.forEach(s=>s())}},this.posts=async s=>{const o=`posts?p=${s??0}&l=${J}`;return this.token?await(await this.getAuth(o)).json():await(await this.get(o)).json()},this.deletePost=async s=>await(await this.delete(`posts/${s}?l=${J}`)).json(),this.user=async s=>{var o;return await(await this.getAuth(`users/${s??((o=this.self)==null?void 0:o.id)}`)).json()},this.updateUser=async(s,o)=>{const r=await(await this.patch(`users/${o??"self"}`,s)).json();return this.self=r,this.userListeners.forEach(n=>n(r)),r},this.updateUserImage=async(s,o)=>{const r=new FormData;s.image&&r.append("image",s.image),!s.image&&s.predefined&&r.append("predefined",s.predefined);const n=await(await this.postAuthRaw(`users/${o??"self"}/image`,r)).json();return this.self=n,this.userListeners.forEach(i=>i(n)),n},this.newPost=async s=>await(await this.postAuth(`posts?l=${J}`,{...s})).json(),this.updatePost=async(s,o)=>await(await this.patch(`posts/${o}`,s)).json(),this.userPosts=async s=>await(await this.getAuth(`users/${s}/posts?l=${Ze}&s=desc`)).json(),this.post=async(s,o,r)=>{const n=await fetch(`${P}${s}`,{mode:"cors",method:"post",headers:r,body:JSON.stringify(o)});if(n.ok)return n;throw await n.json()},this.postAuth=async(s,o,r)=>{const n=await fetch(`${P}${s}`,{mode:"cors",method:"post",headers:{token:this.token??"",...r},body:JSON.stringify(o)});if(n.ok)return n;throw await n.json()},this.postAuthRaw=async(s,o,r)=>{const n=await fetch(`${P}${s}`,{mode:"cors",method:"post",headers:{token:this.token??"",...r},body:o});if(n.ok)return n;throw await n.json()},this.get=async(s,o)=>{const r=await fetch(`${P}${s}`,{mode:"cors",method:"get",headers:o});if(r.ok)return r;throw await r.json()},this.getAuth=async(s,o)=>{const r=await fetch(`${P}${s}`,{mode:"cors",method:"get",headers:{token:this.token??"",...o}});if(r.ok)return r;throw await r.json()},this.delete=async(s,o)=>{const r=await fetch(`${P}${s}`,{mode:"cors",method:"delete",headers:{token:this.token??"",...o}});if(r.ok)return r;throw await r.json()},this.patch=async(s,o,r)=>{const n=await fetch(`${P}${s}`,{mode:"cors",method:"patch",headers:{token:this.token??"",...r},body:JSON.stringify(o)});if(n.ok)return n;throw await n.json()},ie)throw new Error("New instance cannot be created!!");ie=this}}const h=new Je;var D=(t=>(t.NOT_FOUND="NotFound",t.UNAUTHORIZED="Unauthorized",t.FAILED_UPDATE="FailedUpdate",t.MISSING_FIELD="MissingField",t))(D||{});O.use(Ve).use(Ge).use(Xe).init({fallbackLng:"en",debug:!1,interpolation:{escapeValue:!1},backend:{loadPath:"/phpCourse/exam/dist/locales/{{lng}}/{{ns}}.json"}});const Ye=({anchorEl:t,handleClose:s})=>e.jsxs(ce,{anchorEl:t,anchorOrigin:{vertical:"bottom",horizontal:"right"},keepMounted:!0,transformOrigin:{vertical:"top",horizontal:"right"},open:!!t,onClose:s,sx:{"& .Line truncated
+1 -1
View File
@@ -5,7 +5,7 @@
<link rel="icon" type="image/svg+xml" href="/phpCourse/exam/dist/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
<script type="module" crossorigin src="/phpCourse/exam/dist/assets/index-DQG2A_qd.js"></script>
<script type="module" crossorigin src="/phpCourse/exam/dist/assets/index-DAvRi6Od.js"></script>
<link rel="modulepreload" crossorigin href="/phpCourse/exam/dist/assets/react-DXd9vB-a.js">
<link rel="modulepreload" crossorigin href="/phpCourse/exam/dist/assets/mui-CxHUbSMi.js">
<link rel="modulepreload" crossorigin href="/phpCourse/exam/dist/assets/tanstack-xmxrKlZO.js">
+1 -1
View File
@@ -4822,7 +4822,7 @@ var drawChart = (function (exports) {
</script>
<script>
/*<!--*/
const data = {"version":2,"tree":{"name":"root","children":[{"name":"assets/zustand-Cc7ZFYQr.js","children":[{"name":"\u0000/node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.3.1/node_modules/use-sync-external-store","children":[{"name":"cjs","children":[{"uid":"91035d8d-1","name":"use-sync-external-store-shim.production.min.js?commonjs-exports"},{"uid":"91035d8d-5","name":"use-sync-external-store-shim.production.min.js?commonjs-proxy"},{"name":"use-sync-external-store-shim","children":[{"uid":"91035d8d-13","name":"with-selector.production.min.js?commonjs-exports"},{"uid":"91035d8d-17","name":"with-selector.production.min.js?commonjs-proxy"}]}]},{"name":"shim","children":[{"uid":"91035d8d-7","name":"index.js?commonjs-module"},{"uid":"91035d8d-11","name":"index.js?commonjs-proxy"},{"uid":"91035d8d-19","name":"with-selector.js?commonjs-module"}]}]},{"name":"node_modules/.pnpm","children":[{"name":"use-sync-external-store@1.2.0_react@18.3.1/node_modules/use-sync-external-store","children":[{"name":"cjs","children":[{"uid":"91035d8d-3","name":"use-sync-external-store-shim.production.min.js"},{"name":"use-sync-external-store-shim/with-selector.production.min.js","uid":"91035d8d-15"}]},{"name":"shim","children":[{"uid":"91035d8d-9","name":"index.js"},{"uid":"91035d8d-21","name":"with-selector.js"}]}]},{"name":"zustand@4.5.4_@types+react@18.3.3_react@18.3.1/node_modules/zustand/esm","children":[{"uid":"91035d8d-23","name":"vanilla.mjs"},{"uid":"91035d8d-25","name":"index.mjs"}]}]}]},{"name":"assets/index-DQG2A_qd.js","children":[{"name":"\u0000vite/modulepreload-polyfill.js","uid":"91035d8d-27"},{"name":"\u0000/node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/client.js?commonjs-exports","uid":"91035d8d-29"},{"name":"node_modules/.pnpm","children":[{"name":"react-dom@18.3.1_react@18.3.1/node_modules/react-dom/client.js","uid":"91035d8d-31"},{"name":"@fontsource+roboto@5.0.13/node_modules/@fontsource/roboto","children":[{"uid":"91035d8d-81","name":"300.css"},{"uid":"91035d8d-83","name":"400.css"},{"uid":"91035d8d-85","name":"500.css"},{"uid":"91035d8d-87","name":"700.css"}]}]},{"name":"src","children":[{"uid":"91035d8d-33","name":"constanst.ts"},{"name":"api/Api.ts","uid":"91035d8d-35"},{"name":"components","children":[{"name":"Error","children":[{"uid":"91035d8d-37","name":"Errors.ts"},{"uid":"91035d8d-45","name":"ErrorComponent.tsx"}]},{"name":"Menus","children":[{"name":"Language/LanguageMenu.tsx","uid":"91035d8d-41"},{"name":"User/UserMenu.tsx","uid":"91035d8d-49"}]},{"name":"Forms","children":[{"name":"Login/LoginForm.tsx","uid":"91035d8d-47"},{"name":"Post/PostForm.tsx","uid":"91035d8d-55"}]},{"name":"Header/Header.tsx","uid":"91035d8d-51"},{"name":"Dialogs","children":[{"name":"PostEdit/PostEditDialog.tsx","uid":"91035d8d-59"},{"name":"UserEdit/UserEditDialog.tsx","uid":"91035d8d-67"},{"name":"UserImage/UserImageDialog.tsx","uid":"91035d8d-69"}]},{"name":"Post/Post.tsx","uid":"91035d8d-61"},{"name":"Profile/Profile.tsx","uid":"91035d8d-71"}]},{"uid":"91035d8d-39","name":"i18n.ts"},{"name":"types/Routes.ts","uid":"91035d8d-43"},{"name":"routes","children":[{"uid":"91035d8d-53","name":"__root.tsx"},{"uid":"91035d8d-65","name":"index.tsx"},{"name":"profile","children":[{"uid":"91035d8d-75","name":"index.tsx"},{"uid":"91035d8d-77","name":"$id.tsx"}]}]},{"name":"utils/date.ts","uid":"91035d8d-57"},{"name":"queries","children":[{"uid":"91035d8d-63","name":"postsQuery.ts"},{"uid":"91035d8d-73","name":"profileQuery.ts"}]},{"uid":"91035d8d-79","name":"routeTree.gen.ts"},{"uid":"91035d8d-89","name":"main.tsx"}]},{"uid":"91035d8d-91","name":"index.html"}]},{"name":"assets/i18n-DJgSTqOl.js","children":[{"name":"node_modules/.pnpm","children":[{"name":"void-elements@3.1.0/node_modules/void-elements/index.js","uid":"91035d8d-93"},{"name":"html-parse-stringify@3.0.1/node_modules/html-parse-stringify/dist/html-parse-stringify.module.js","uid":"91035d8d-95"},{"name":"react-i18next@15.0.0_i18next@23.12.2_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/react-i18next/dist/es","children":[{"uid":"91035d8d-97","name":"utils.js"},{"uid":"91035d8d-99","name":"unescape.js"},{"uid":"91035d8d-101","name":"defaults.js"},{"uid":"91035d8d-103","name":"i18nInstance.js"},{"uid":"91035d8d-105","name":"TransWithoutContext.js"},{"uid":"91035d8d-107","name":"initReactI18next.js"},{"uid":"91035d8d-109","name":"context.js"},{"uid":"91035d8d-111","name":"Trans.js"},{"uid":"91035d8d-113","name":"useTranslation.js"},{"uid":"91035d8d-115","name":"withTranslation.js"},{"uid":"91035d8d-117","name":"Translation.js"},{"uid":"91035d8d-119","name":"I18nextProvider.js"},{"uid":"91035d8d-121","name":"useSSR.js"},{"uid":"91035d8d-123","name":"withSSR.js"},{"uid":"91035d8d-125","name":"index.js"}]},{"name":"i18next@23.12.2/node_modules/i18next/dist/esm/i18next.js","uid":"91035d8d-127"},{"name":"i18next-browser-languagedetector@8.0.0/node_modules/i18next-browser-languagedetector/dist/esm/i18nextBrowserLanguageDetectoLine truncated
const data = {"version":2,"tree":{"name":"root","children":[{"name":"assets/zustand-Cc7ZFYQr.js","children":[{"name":"\u0000/node_modules/.pnpm/use-sync-external-store@1.2.0_react@18.3.1/node_modules/use-sync-external-store","children":[{"name":"cjs","children":[{"uid":"0afff94b-1","name":"use-sync-external-store-shim.production.min.js?commonjs-exports"},{"uid":"0afff94b-5","name":"use-sync-external-store-shim.production.min.js?commonjs-proxy"},{"name":"use-sync-external-store-shim","children":[{"uid":"0afff94b-13","name":"with-selector.production.min.js?commonjs-exports"},{"uid":"0afff94b-17","name":"with-selector.production.min.js?commonjs-proxy"}]}]},{"name":"shim","children":[{"uid":"0afff94b-7","name":"index.js?commonjs-module"},{"uid":"0afff94b-11","name":"index.js?commonjs-proxy"},{"uid":"0afff94b-19","name":"with-selector.js?commonjs-module"}]}]},{"name":"node_modules/.pnpm","children":[{"name":"use-sync-external-store@1.2.0_react@18.3.1/node_modules/use-sync-external-store","children":[{"name":"cjs","children":[{"uid":"0afff94b-3","name":"use-sync-external-store-shim.production.min.js"},{"name":"use-sync-external-store-shim/with-selector.production.min.js","uid":"0afff94b-15"}]},{"name":"shim","children":[{"uid":"0afff94b-9","name":"index.js"},{"uid":"0afff94b-21","name":"with-selector.js"}]}]},{"name":"zustand@4.5.4_@types+react@18.3.3_react@18.3.1/node_modules/zustand/esm","children":[{"uid":"0afff94b-23","name":"vanilla.mjs"},{"uid":"0afff94b-25","name":"index.mjs"}]}]}]},{"name":"assets/index-DAvRi6Od.js","children":[{"name":"\u0000vite/modulepreload-polyfill.js","uid":"0afff94b-27"},{"name":"\u0000/node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/client.js?commonjs-exports","uid":"0afff94b-29"},{"name":"node_modules/.pnpm","children":[{"name":"react-dom@18.3.1_react@18.3.1/node_modules/react-dom/client.js","uid":"0afff94b-31"},{"name":"@fontsource+roboto@5.0.13/node_modules/@fontsource/roboto","children":[{"uid":"0afff94b-81","name":"300.css"},{"uid":"0afff94b-83","name":"400.css"},{"uid":"0afff94b-85","name":"500.css"},{"uid":"0afff94b-87","name":"700.css"}]}]},{"name":"src","children":[{"uid":"0afff94b-33","name":"constanst.ts"},{"name":"api/Api.ts","uid":"0afff94b-35"},{"name":"components","children":[{"name":"Error","children":[{"uid":"0afff94b-37","name":"Errors.ts"},{"uid":"0afff94b-45","name":"ErrorComponent.tsx"}]},{"name":"Menus","children":[{"name":"Language/LanguageMenu.tsx","uid":"0afff94b-41"},{"name":"User/UserMenu.tsx","uid":"0afff94b-49"}]},{"name":"Forms","children":[{"name":"Login/LoginForm.tsx","uid":"0afff94b-47"},{"name":"Post/PostForm.tsx","uid":"0afff94b-55"}]},{"name":"Header/Header.tsx","uid":"0afff94b-51"},{"name":"Dialogs","children":[{"name":"PostEdit/PostEditDialog.tsx","uid":"0afff94b-59"},{"name":"UserEdit/UserEditDialog.tsx","uid":"0afff94b-67"},{"name":"UserImage/UserImageDialog.tsx","uid":"0afff94b-69"}]},{"name":"Post/Post.tsx","uid":"0afff94b-61"},{"name":"Profile/Profile.tsx","uid":"0afff94b-71"}]},{"uid":"0afff94b-39","name":"i18n.ts"},{"name":"types/Routes.ts","uid":"0afff94b-43"},{"name":"routes","children":[{"uid":"0afff94b-53","name":"__root.tsx"},{"uid":"0afff94b-65","name":"index.tsx"},{"name":"profile","children":[{"uid":"0afff94b-75","name":"index.tsx"},{"uid":"0afff94b-77","name":"$id.tsx"}]}]},{"name":"utils/date.ts","uid":"0afff94b-57"},{"name":"queries","children":[{"uid":"0afff94b-63","name":"postsQuery.ts"},{"uid":"0afff94b-73","name":"profileQuery.ts"}]},{"uid":"0afff94b-79","name":"routeTree.gen.ts"},{"uid":"0afff94b-89","name":"main.tsx"}]},{"uid":"0afff94b-91","name":"index.html"}]},{"name":"assets/i18n-DJgSTqOl.js","children":[{"name":"node_modules/.pnpm","children":[{"name":"void-elements@3.1.0/node_modules/void-elements/index.js","uid":"0afff94b-93"},{"name":"html-parse-stringify@3.0.1/node_modules/html-parse-stringify/dist/html-parse-stringify.module.js","uid":"0afff94b-95"},{"name":"react-i18next@15.0.0_i18next@23.12.2_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/react-i18next/dist/es","children":[{"uid":"0afff94b-97","name":"utils.js"},{"uid":"0afff94b-99","name":"unescape.js"},{"uid":"0afff94b-101","name":"defaults.js"},{"uid":"0afff94b-103","name":"i18nInstance.js"},{"uid":"0afff94b-105","name":"TransWithoutContext.js"},{"uid":"0afff94b-107","name":"initReactI18next.js"},{"uid":"0afff94b-109","name":"context.js"},{"uid":"0afff94b-111","name":"Trans.js"},{"uid":"0afff94b-113","name":"useTranslation.js"},{"uid":"0afff94b-115","name":"withTranslation.js"},{"uid":"0afff94b-117","name":"Translation.js"},{"uid":"0afff94b-119","name":"I18nextProvider.js"},{"uid":"0afff94b-121","name":"useSSR.js"},{"uid":"0afff94b-123","name":"withSSR.js"},{"uid":"0afff94b-125","name":"index.js"}]},{"name":"i18next@23.12.2/node_modules/i18next/dist/esm/i18next.js","uid":"0afff94b-127"},{"name":"i18next-browser-languagedetector@8.0.0/node_modules/i18next-browser-languagedetector/dist/esm/i18nextBrowserLanguageDetectoLine truncated
const run = () => {
const width = window.innerWidth;
@@ -25,6 +25,7 @@ import { useMutation, useQueryClient } from '@tanstack/react-query';
import { t } from 'i18next';
import { FC, FormEvent, useState } from 'react';
import Api from '../../../api/Api';
import { STORAGE_PATH } from '../../../constanst';
import { User, UserImageUpdate } from '../../../types/User';
import ErrorComponent from '../../Error/ErrorComponent';
@@ -109,8 +110,8 @@ const UserImageDialog: FC<Props> = ({ user, open, onClose }) => {
formState.image
? URL.createObjectURL(formState.image)
: formState.predefined
? `/storage/profilbilder/default/${formState.predefined}.svg`
: `/storage/${user.image}`
? `${STORAGE_PATH}profilbilder/default/${formState.predefined}.svg`
: `${STORAGE_PATH}${user.image}`
}
sx={{ width: '100px', height: '100px' }}
>
+2 -1
View File
@@ -13,6 +13,7 @@ import { Link, useRouterState } from '@tanstack/react-router';
import { cloneElement, FC, ReactElement, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import Api from '../../api/Api';
import { STORAGE_PATH } from '../../constanst';
import { User } from '../../types/User';
import LanguageMenu from '../Menus/Language/LanguageMenu';
import UserMenu from '../Menus/User/UserMenu';
@@ -61,7 +62,7 @@ const Header: FC = () => {
</IconButton>
{user ? (
<IconButton onClick={(event) => setAnchorUserMenu(event.currentTarget)} sx={{ p: 0 }}>
<Avatar alt={user.username} src={`/storage/${user.image}`}>
<Avatar alt={user.username} src={`${STORAGE_PATH}/${user.image}`}>
<Person />
</Avatar>
</IconButton>
+4 -3
View File
@@ -21,6 +21,7 @@ import { Link, useNavigate } from '@tanstack/react-router';
import { FC, useState } from 'react';
import { useTranslation } from 'react-i18next';
import Api from '../../api/Api';
import { STORAGE_PATH } from '../../constanst';
import { PostAuth, PostNonAuth } from '../../types/Post';
import convertDate from '../../utils/date';
import PostEditDialog from '../Dialogs/PostEdit/PostEditDialog';
@@ -54,19 +55,19 @@ const Post: FC<Props> = ({ post, disableActions }) => {
!disableActions && 'id' in post.user ? (
post.user.id !== Api.getAuthenticatedUser()?.id ? (
<MUILink component={Link} to="/profile/$id" params={{ id: post.user.id }}>
<Avatar alt={post.user.username} src={`/storage/${post.user.image}`}>
<Avatar alt={post.user.username} src={`${STORAGE_PATH}${post.user.image}`}>
<Person />
</Avatar>
</MUILink>
) : (
<MUILink component={Link} to="/profile">
<Avatar alt={post.user.username} src={`/storage/${post.user.image}`}>
<Avatar alt={post.user.username} src={`${STORAGE_PATH}${post.user.image}`}>
<Person />
</Avatar>
</MUILink>
)
) : (
<Avatar alt={post.user.username} src={`/storage/${post.user.image}`}>
<Avatar alt={post.user.username} src={`${STORAGE_PATH}${post.user.image}`}>
<Person />
</Avatar>
)
@@ -19,6 +19,7 @@ import convertDate from '../../utils/date';
import UserEditDialog from '../Dialogs/UserEdit/UserEditDialog';
import UserImageDialog from '../Dialogs/UserImage/UserImageDialog';
import Post from '../Post/Post';
import { STORAGE_PATH } from '../../constanst';
interface Props {
user: User;
@@ -40,7 +41,7 @@ const Profile: FC<Props> = ({ user, posts, canEdit }) => {
<Grid container spacing={2}>
<Grid item sx={{ display: 'flex', flexGrow: 1, justifyContent: 'center' }}>
<IconButton onClick={() => setImageOpen(true)}>
<Avatar alt={user.username} src={`/storage/${user.image}`} sx={{ width: '100px', height: '100px' }}>
<Avatar alt={user.username} src={`${STORAGE_PATH}${user.image}`} sx={{ width: '100px', height: '100px' }}>
<Person sx={{ width: '60px', height: '60px' }} />
</Avatar>
</IconButton>
+1
View File
@@ -1,3 +1,4 @@
export const POST_LIMIT = 15;
export const PROFILE_POST_LIMIT = 3;
export const POST_CHAR_LIMIT = 250;
export const STORAGE_PATH = '/phpCourse/exam/storage/';