Path again

This commit is contained in:
Kilian Hofmann 2024-07-27 23:10:26 +02:00
parent 9d6bd65583
commit 72a0ad6364
9 changed files with 15 additions and 10 deletions

1
exam/dist/assets/index-DAvRi6Od.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

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">

File diff suppressed because one or more lines are too long

View File

@ -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' }}
>

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>

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>
)

View File

@ -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>

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/';