Skip to content

Commit

Permalink
Merge pull request #9 from DziedzicGrzegorz/dev
Browse files Browse the repository at this point in the history
Full Stack
  • Loading branch information
DziedzicGrzegorz authored Apr 2, 2024
2 parents 28fcb97 + 3ed53b5 commit 8a9bfe9
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 17 deletions.
22 changes: 16 additions & 6 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,34 @@ Projekt zakłada stworzenie aplikacji webowej umożliwiającej szyfrowanie i des

## konfiguracją parametrów środowiskowych
W celu uzupełnienia kluczy i haseł należy utworzyć plik `application.properties` w folderze `backend/src/main/resources` i dodać do niego następujące linie:

```properties
spring.application.name=
spring.datasource.url=
spring.datasource.username=
spring.datasource.password=
spring.jpa.hibernate.ddl-auto=update
spring.session.jdbc.initialize-schema=always
jwt.secret=
```
oraz .env
```properties
spring.datasource.username=
spring.datasource.password=
#Generate JWS, base64 required https://8gwifi.org/jwsgen.jsp
jwt.secret=
POSTGRES_USER=
POSTGRES_PASSWORD=
POSTGRES_DB=
SPRING_DATASOURCE_URL=
SPRING_DATASOURCE_USERNAME=
SPRING_DATASOURCE_PASSWORD=
```

## Uruchomienie
```bash
docker-compose up --build

```

## Porty
Serwisy działają na następujących portach

- Frontend: http://localhost:4173
- Backend: http://localhost:8080
- Baza danych: http://localhost:5432

2 changes: 1 addition & 1 deletion backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

group = 'dziedzic.dev'
version = '0.0.1-SNAPSHOT'
version = '1.0.0-SNAPSHOT'

java {
sourceCompatibility = '21'
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "frontend",
"private": true,
"version": "0.0.0",
"version": "1.0.0",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/pages/dashboard/columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ export function columnsWrapper({
},
cell: ({row}) => {
const messageIdentifier = row.getValue("messageIdentifier") as string;
const isTruncated = messageIdentifier.length > 15;
const displayText = isTruncated ? `${messageIdentifier.slice(0, 15)}...` : messageIdentifier;
const isTruncated = messageIdentifier.length > 10;
const displayText = isTruncated ? `${messageIdentifier.slice(0, 10)}...` : messageIdentifier;

return (
<div>
Expand All @@ -118,7 +118,7 @@ export function columnsWrapper({
<HoverCardTrigger asChild>
<button>{displayText}</button>
</HoverCardTrigger>
<HoverCardContent className='w-80'>
<HoverCardContent className='w-80 overflow-auto'>
<div className='flex justify-between space-x-4'>
<div className='space-y-1'>
<h4 className='text-sm font-semibold'>Description</h4>
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/pages/dashboard/components/data-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export function DataTable<TData, TValue>({columns, data,}: DataTableProps<TData,
const [columnVisibility, setColumnVisibility] = useState<VisibilityState>({})
const media = useMediaQuery("(min-width: 1024px)")
const smallMedia = useMediaQuery("(min-width: 768px)")
const smallMedia2 = useMediaQuery("(min-width: 640px)")


const table = useReactTable({
Expand All @@ -64,8 +65,9 @@ export function DataTable<TData, TValue>({columns, data,}: DataTableProps<TData,
useEffect(() => {
table.getColumn('decrypted')!.toggleVisibility(media)
table.getColumn('createdDateTime')!.toggleVisibility(smallMedia)
table.getColumn('id')!.toggleVisibility(smallMedia2)

}, [media, smallMedia, table]);
}, [media, smallMedia, table,smallMedia2]);
return (
<>
<div className="w-[85%] flex justify-between items-center space-x-4 mx-auto py-5">
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/pages/dashboard/components/encrypt-message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import {TextGenerateEffect} from "@/components/text-generator-effect.tsx";
import {useState} from "react";

const encryptRequestSchema = z.object({
message: z.string().min(1, "Message is required").max(255, "Message must be at most 255 characters"),
password: z.string().min(6, "Password must be at least 6 characters").max(255, "Encryption password must be at most 255 characters"),
messageIdentifier: z.string().min(1, "Message identifier is required").max(255, "Message identifier must be at most 255 characters"),
message: z.string().min(1, "Message is required").max(140, "Message must be at most 140 characters"),
password: z.string().min(6, "Password must be at least 6 characters").max(140, "Encryption password must be at most 140 characters"),
messageIdentifier: z.string().min(1, "Message identifier is required").max(140, "Message identifier must be at most 140 characters"),
});

interface EncryptMessageProps {
Expand Down Expand Up @@ -62,7 +62,7 @@ export function EncryptMessage({onFormSubmitSuccess}: EncryptMessageProps) {
Encrypt Message
</button>
</DialogTrigger>
<DialogContent className="sm:max-w-[425px]">
<DialogContent className="sm:max-w-[375px]">
<DialogHeader>
<DialogTitle>Encrypt Message</DialogTitle>
</DialogHeader>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ interface PasswordDialogProps {
}

const passwordSchema = z.object({
password: z.string().min(6, {message: "Password must be at least 6 characters long"}).max(100, {message: "Password must be at most 100 characters long"}),
password: z.string().min(6, {message: "Password must be at least 6 characters long"}).max(140, {message: "Password must be at most 140 characters long"}),
});
type PasswordSchema = z.infer<typeof passwordSchema>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export function ShowDecryptedMessage({
<AlertDialogHeader>
<AlertDialogTitle>Your Decrypted Message</AlertDialogTitle>
<AlertDialogDescription
className="break-words max-h-96 w-96"
>
{decryptedMessage?.message}
</AlertDialogDescription>
Expand Down

0 comments on commit 8a9bfe9

Please sign in to comment.