-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add groseries #6
Merged
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
db8b4d1
add groseries backend
Olgasyla cd464d0
Merge branch 'refs/heads/main' into add-groseries
Olgasyla 51a5a86
add groseries backend
Olgasyla 73c42e4
add groseries frontend
Olgasyla 4b99bb9
add groseries frontend
Olgasyla 4cc3140
Merge remote-tracking branch 'refs/remotes/origin/add-groseries' into…
Olgasyla 788b3c6
index.html frontend/dist file deleted
Olgasyla 5126d23
saveProdukt rename to addProdukt
Olgasyla File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package org.example.backend; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import java.util.UUID; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
|
||
public class IdService { | ||
|
||
public String randomId() { | ||
return UUID.randomUUID().toString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.example.backend; | ||
|
||
import lombok.With; | ||
|
||
@With | ||
public record NewProduct( | ||
String name, | ||
int amount | ||
){} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Vite + React + TS</title> | ||
<script type="module" crossorigin src="/assets/index-DO30CrK6.js"></script> | ||
<link rel="stylesheet" crossorigin href="/assets/index-DiwrgTda.css"> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,5 +14,4 @@ export default function App() { | |
|
||
</div> | ||
) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
.add-product { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 1rem; | ||
padding: 1rem; | ||
background-color: #f8f8f8; | ||
border-radius: 10px; | ||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); | ||
} | ||
|
||
.add-product h3 { | ||
font-size: 1.8rem; | ||
color: #333; | ||
text-align: center; | ||
} | ||
|
||
.name-input { | ||
width: 100%; | ||
padding: 0.5rem; | ||
border: 2px solid #cccccc; | ||
border-radius: 5px; | ||
font-size: 1rem; | ||
} | ||
|
||
.amount-input { | ||
width: 50%; | ||
padding: 0.5rem; | ||
border: 2px solid #cccccc; | ||
border-radius: 5px; | ||
font-size: 1rem; | ||
} | ||
|
||
button { | ||
background-color: #4CAF50; | ||
color: white; | ||
padding: 0.7rem 1.5rem; | ||
border: none; | ||
border-radius: 5px; | ||
cursor: pointer; | ||
font-size: 1rem; | ||
transition: background-color 0.3s ease, transform 0.1s ease; | ||
} | ||
|
||
button:hover { | ||
background-color: #45a049; | ||
} | ||
|
||
button:active { | ||
transform: scale(0.95); /* Эффект нажатия */ | ||
background-color: #3e8e41; /* Темнее цвет для эффекта нажатия */ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { useState, ChangeEvent, FormEvent } from 'react' | ||
import axios from 'axios' | ||
import { Product } from "../models/product.tsx" | ||
|
||
|
||
type AddProductProps = { | ||
productAdd: () => void; | ||
}; | ||
|
||
export default function AddProduct({ productAdd }: AddProductProps) { | ||
const [name, setName] = useState(""); | ||
const [amount, setAmount] = useState("") | ||
|
||
const handleSubmit = (event: FormEvent<HTMLFormElement>) => { | ||
event.preventDefault(); | ||
|
||
const newProduct = { | ||
name: name.trim(), | ||
amount: parseInt(amount) | ||
} | ||
|
||
axios.post<Product>("/api/products", newProduct) | ||
.then(() => { | ||
setName("") | ||
setAmount("") | ||
productAdd() | ||
}) | ||
.catch(error => { | ||
console.error("Es ist ein Fehler aufgetreten!", error) | ||
}) | ||
} | ||
|
||
return ( | ||
<div className="add-product"> | ||
<h3>Neues Produkt hinzufügen</h3> | ||
<form onSubmit={handleSubmit}> | ||
<input type="text" value={name} onChange={(event: ChangeEvent<HTMLInputElement>) => setName(event.target.value)} | ||
placeholder="Product name" /> | ||
<input type="number" value={amount} | ||
onChange={(event: ChangeEvent<HTMLInputElement>) => setAmount(event.target.value)} | ||
placeholder="Menge"/> | ||
<button type="submit">Produkt hinzufügen </button> | ||
</form> | ||
</div> | ||
) | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe rename saveProduct - method name to addProduct