mirror of
https://github.com/bubblecup-12/VogelSocialMedia.git
synced 2025-07-06 15:18:48 +00:00
first stages for endpoints
This commit is contained in:
parent
f66e94b05d
commit
d6517126d2
3 changed files with 45 additions and 24 deletions
|
@ -6,6 +6,7 @@ import Autocomplete from '@mui/material/Autocomplete';
|
||||||
import TextField from '@mui/material/TextField';
|
import TextField from '@mui/material/TextField';
|
||||||
import Avatar from '@mui/material/Avatar';
|
import Avatar from '@mui/material/Avatar';
|
||||||
import Close from '@mui/icons-material/Close';
|
import Close from '@mui/icons-material/Close';
|
||||||
|
import ButtonPrimary from "../components/ButtonRotkehlchen";
|
||||||
|
|
||||||
import "../styles/sizes.css";
|
import "../styles/sizes.css";
|
||||||
import "../styles/fonts.css";
|
import "../styles/fonts.css";
|
||||||
|
@ -15,6 +16,9 @@ import Box from '@mui/joy/Box';
|
||||||
import Card from '@mui/joy/Card';
|
import Card from '@mui/joy/Card';
|
||||||
import IconButton from '@mui/joy/IconButton';
|
import IconButton from '@mui/joy/IconButton';
|
||||||
|
|
||||||
|
import axios from "axios";
|
||||||
|
|
||||||
|
|
||||||
function PostCreation(){
|
function PostCreation(){
|
||||||
const startTags = [
|
const startTags = [
|
||||||
{ title: 'Bird' },
|
{ title: 'Bird' },
|
||||||
|
@ -28,20 +32,22 @@ function PostCreation(){
|
||||||
interface ImageItem {
|
interface ImageItem {
|
||||||
src: string;
|
src: string;
|
||||||
title: string;
|
title: string;
|
||||||
description: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type FormData = {
|
||||||
{/*const theme = createTheme({
|
images: Array<string>;
|
||||||
palette: {
|
status: string;
|
||||||
primary: {
|
description: string;
|
||||||
main: '#EAC22A'
|
tags: Array<string>;
|
||||||
},
|
}
|
||||||
secondary: {
|
|
||||||
main: '#4C4141'
|
const [formData, setFormData] = useState<FormData>({
|
||||||
},
|
images: [""],
|
||||||
},
|
status: "PUBLIC",
|
||||||
});*/}
|
description: "",
|
||||||
|
tags: [""],
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
const initialOptions = startTags.map((option) => option.title);
|
const initialOptions = startTags.map((option) => option.title);
|
||||||
|
|
||||||
|
@ -79,20 +85,34 @@ function PostCreation(){
|
||||||
const handleDelete = (idx: number) =>
|
const handleDelete = (idx: number) =>
|
||||||
setData((prev) => prev.filter((_, i) => i !== idx));
|
setData((prev) => prev.filter((_, i) => i !== idx));
|
||||||
|
|
||||||
|
const onSubmit = async(event: React.FormEvent) =>{
|
||||||
|
event.preventDefault();
|
||||||
|
try {
|
||||||
|
await axios.post("http://localhost:3001/api/posts/upload", {
|
||||||
|
images: {data},
|
||||||
|
status: "PUBLIC",
|
||||||
|
description: formData.description,
|
||||||
|
tags: formData.tags,
|
||||||
|
})
|
||||||
|
} catch (error:any) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const username = "Username12345678";
|
const username = "Username12345678";
|
||||||
|
|
||||||
return(
|
return(
|
||||||
<div className="create-display">
|
<div className="create-display">
|
||||||
<div className="create-part">
|
<div className="create-part">
|
||||||
<form>
|
<form onSubmit={onSubmit}>
|
||||||
<h1>Create Post</h1>
|
<h1>Create Post</h1>
|
||||||
<div className="create-account">
|
<div className="create-account">
|
||||||
<Avatar sx={{}}>OP</Avatar>
|
<Avatar sx={{}}>OP</Avatar>
|
||||||
<span className="create-username">{username}</span>
|
<span className="create-username">{username}</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="create-post1">
|
<div className="create-post1">
|
||||||
<img src={selectedImage} className="create-post-image" alt="Image"></img>
|
<img src={selectedImage} className="create-post-image" alt="Add an Image"></img>
|
||||||
<textarea className="create-post-description"></textarea>
|
<textarea className="create-post-description" value={formData.description}></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div className="create-post2">
|
<div className="create-post2">
|
||||||
<Box
|
<Box
|
||||||
|
@ -133,7 +153,7 @@ function PostCreation(){
|
||||||
size="sm"
|
size="sm"
|
||||||
key={`${item.title}-${idx}`}
|
key={`${item.title}-${idx}`}
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
sx={{ position: 'relative' }}
|
sx={{ position: 'relative'}}
|
||||||
onClick={() => setSelectedImage(item.src)}
|
onClick={() => setSelectedImage(item.src)}
|
||||||
>
|
>
|
||||||
{/* delete pill */}
|
{/* delete pill */}
|
||||||
|
@ -190,7 +210,7 @@ function PostCreation(){
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="create-post3">
|
<div className="create-post3">
|
||||||
<input type="submit" value={"Post"} className="login-button"></input>
|
<ButtonPrimary style="primary" label="Post" type="submit" ></ButtonPrimary>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
|
|
||||||
.login-input {
|
.login-input {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 40px;
|
height: 38px;
|
||||||
border: none;
|
border: none;
|
||||||
color: var(--Rotkehlchen-brown-middle);
|
color: var(--Rotkehlchen-brown-middle);
|
||||||
outline: 0 !important;
|
outline: 0 !important;
|
||||||
|
|
|
@ -6,10 +6,6 @@
|
||||||
.create-display{
|
.create-display{
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 100vh; /* Full viewport height */
|
|
||||||
width: 100vw; /* Full viewport width */
|
|
||||||
position: absolute;
|
|
||||||
background: var(--gradient-blue-backround-mobile, linear-gradient(270deg, rgba(20, 15, 86, 0.27) 0%, rgba(20, 15, 86, 0.58) 24%, rgba(20, 15, 86, 0.74) 43%, rgba(17, 13, 71, 0.82) 56%, rgba(13, 10, 56, 0.90) 68%), url('/public/assets/images/BirdsSky.jpg') lightgray 50% / cover no-repeat);
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
@ -52,7 +48,7 @@
|
||||||
width: 90vw;
|
width: 90vw;
|
||||||
}
|
}
|
||||||
.create-post-image{
|
.create-post-image{
|
||||||
height: 50vh;
|
height: 40vh;
|
||||||
width: 90vw;
|
width: 90vw;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
@ -76,8 +72,13 @@ input#create-file-upload[type="file"] {
|
||||||
}
|
}
|
||||||
|
|
||||||
@media only screen and (min-width: 768px) {
|
@media only screen and (min-width: 768px) {
|
||||||
|
.create-display{
|
||||||
|
padding-top: calc(var(--Header-height) + 1rem);
|
||||||
|
padding-bottom: 1rem;
|
||||||
|
}
|
||||||
.create-part{
|
.create-part{
|
||||||
width: 90vw;
|
width: 90vw;
|
||||||
|
height: calc(100vh - var(--Header-height));
|
||||||
}
|
}
|
||||||
.create-post1{
|
.create-post1{
|
||||||
width:70vw;
|
width:70vw;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue