Skip to content
Open

#4 #44

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
cf09795
Creat letter table
macias95 Dec 17, 2022
08fd5ef
improve code formating
macias95 Dec 17, 2022
8598818
Merge pull request #33 from deployed/8_letters_table
Fadikk367 Dec 17, 2022
f033d42
Table added
MichaelAngeloTheFirst Dec 17, 2022
c34d96d
Timer__task_number_6
MichaelAngeloTheFirst Dec 17, 2022
70c0862
css fixed :)
MichaelAngeloTheFirst Dec 17, 2022
10effa7
Create modal
piotrkowalczyk53 Dec 17, 2022
16f9784
Adding table to Packages component
MichaelAngeloTheFirst Dec 17, 2022
ddeb035
3 - sleigh progress bar
dzlk17 Dec 17, 2022
3177d39
deleted unused parts of code
MichaelAngeloTheFirst Dec 17, 2022
6a847c2
separeted into files
MichaelAngeloTheFirst Dec 17, 2022
9c028fc
3 - refactoring
dzlk17 Dec 17, 2022
282b729
Merge pull request #36 from deployed/6_timer_component
Critteros Dec 17, 2022
22c51f5
unnnecesary thigs deleted
MichaelAngeloTheFirst Dec 17, 2022
d150f10
Merge pull request #37 from deployed/3_sleigh_progress_bar
KarolinaZielonka Dec 17, 2022
71db72b
Merge pull request #34 from deployed/16-Packages-Table
Fadikk367 Dec 17, 2022
2480b4e
dziala
Dec 17, 2022
ae06ca4
zwracaTableCell
Dec 17, 2022
97c5b8b
addig implements of package lis
CoreNest Dec 17, 2022
43167eb
rebase on b_master
Dec 17, 2022
e6c3529
Merge branch 'b_master' of github.com:deployed/santa-workshop-2022 in…
CoreNest Dec 17, 2022
202b14d
component display kids names
macias95 Dec 17, 2022
1be44ee
Update VerifyLetter.tsx
piotrkowalczyk53 Dec 17, 2022
646a531
Merge pull request #38 from deployed/10_name_component
Fadikk367 Dec 17, 2022
af84ce2
Create modal
piotrkowalczyk53 Dec 17, 2022
fbd706a
Update VerifyLetter.tsx
piotrkowalczyk53 Dec 17, 2022
f17d7b9
Revert "Merge branch 'b_master' of github.com:deployed/santa-workshop…
Dec 17, 2022
06f6417
b_#4 package list
CoreNest Dec 17, 2022
be23144
Fixed package.json
piotrkowalczyk53 Dec 17, 2022
a202c10
Delete verifyLetter.css
piotrkowalczyk53 Dec 17, 2022
815da50
imporvedAfterReview
Dec 17, 2022
93e808c
Merge branch 'b-25-verifyModal' of https://github.com/deployed/santa-…
piotrkowalczyk53 Dec 17, 2022
e56ac86
Review fixes
piotrkowalczyk53 Dec 17, 2022
4db8135
newmovedNewLines
Dec 17, 2022
3bb3e47
Merge pull request #43 from deployed/22DatesTable
Fadikk367 Dec 17, 2022
6d7e122
13-component display country
macias95 Dec 17, 2022
8dfbca2
Merge pull request #45 from deployed/b-25-verifyModal
sayard Dec 17, 2022
fe80503
Merge branch 'b_master' into listpack
CoreNest Dec 17, 2022
5122e2e
13-display country in label
macias95 Dec 17, 2022
b94c09d
Merge pull request #49 from deployed/13_Letter_country_table
KarolinaZielonka Dec 17, 2022
2b7c0c4
component added to table
Dec 17, 2022
87a283d
Merge branch 'b_master' into 15_letter_creation_date
Fadikk367 Dec 17, 2022
a7a1fa3
Merge pull request #50 from deployed/15_letter_creation_date
Fadikk367 Dec 17, 2022
75177bb
b_#4 package list
CoreNest Dec 17, 2022
bc41652
9
dzlk17 Dec 17, 2022
c214292
Merge branch 'listpack' of github.com:deployed/santa-workshop-2022 in…
CoreNest Dec 17, 2022
1bff466
packaging
dzlk17 Dec 17, 2022
33e1f71
Merge pull request #54 from deployed/19_Package_Status_Column
KarolinaZielonka Dec 17, 2022
7ce0d03
Send presents with list component
MichaelAngeloTheFirst Dec 17, 2022
ee65b48
Merge branch 'listpack' of github.com:deployed/santa-workshop-2022 in…
CoreNest Dec 17, 2022
5af2609
Merge pull request #57 from deployed/27_modal_list
KarolinaZielonka Dec 17, 2022
a4aee24
Merge branch 'listpack' of github.com:deployed/santa-workshop-2022 in…
CoreNest Dec 17, 2022
1749962
Finished task 26
piotrkowalczyk53 Dec 17, 2022
8a72e55
Merge branch 'b_master' into listpack
Fadikk367 Dec 17, 2022
582850b
Merge pull request #47 from deployed/listpack
Fadikk367 Dec 17, 2022
4308feb
Add accept & reject buttons
piotrkowalczyk53 Dec 17, 2022
d4dbb64
Merge branch 'b_master' into b-26-applyModal
Fadikk367 Dec 17, 2022
1650541
Merge pull request #58 from deployed/b-26-applyModal
Fadikk367 Dec 17, 2022
20e4fa3
distribution view
Dec 17, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@
"last 1 safari version"
]
}
}
}
15 changes: 15 additions & 0 deletions src/components/CreationDate/CreationDate.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react'
import TableCell from '@mui/material/TableCell';
import {formatDate} from './utils'

const CreationDate: React.FC<{date: string} > = ({date}) => {
const properDate = formatDate(date);

return(
<TableCell component="th" scope="row">
{properDate}
</TableCell>
);
}

export default CreationDate;
1 change: 1 addition & 0 deletions src/components/CreationDate/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {default} from './CreationDate'
9 changes: 9 additions & 0 deletions src/components/CreationDate/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export function formatDate(baseDate: string): string{
const newDate = new Date(baseDate);

const year = newDate.getFullYear();
const month = newDate.getMonth();
const day = newDate.getDay();

return `${day < 10 ? `0${day}` : day }-${month}-${year}`;
}
50 changes: 50 additions & 0 deletions src/components/ListModal/ListModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import List from '@mui/material/List';
import ListItem from '@mui/material/ListItem';
import ListItemButton from '@mui/material/ListItemButton';
import ListItemText from '@mui/material/ListItemText';
import Checkbox from '@mui/material/Checkbox';
import { useState } from 'react';



const ListModal = () =>{

let myList: string[] = ["jeden", "dwa", "trzy"];

const [checked, setChecked] = useState([1]);

const handleToggle = (value: string) => () => {
const newChecked = [...checked];

setChecked(newChecked);
};

return (
<List dense sx={{ width: '100%', maxWidth: 360, bgcolor: 'background.paper' }}>
{myList.map((value) => {
const labelId = `checkbox-list-secondary-label-${value}`;
return (
<ListItem
key={value}
secondaryAction={
<Checkbox
edge="end"
onChange={handleToggle(value)}
//checked={checked.indexOf(value) !== -1}
inputProps={{ 'aria-labelledby': labelId }}
/>
}
disablePadding
>
<ListItemButton>
<ListItemText id={labelId} primary={`${value}`} />
</ListItemButton>
</ListItem>
);
})}
</List>
);

}

export default ListModal
1 change: 1 addition & 0 deletions src/components/ListModal/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './ListModal';
9 changes: 9 additions & 0 deletions src/components/Name/Country.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Typography from '@mui/material/Typography/Typography'
import React from 'react'

const Country = ({country}: {country : string}) => (
<Typography>{country}</Typography>
)


export default Country;
9 changes: 9 additions & 0 deletions src/components/Name/Name.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Typography from '@mui/material/Typography';
import React from 'react';

const Name = ({fullName}: {fullName: string}) => {
return <Typography>{fullName}</Typography>
}

export default Name;

62 changes: 62 additions & 0 deletions src/components/PackagesList/PackagesList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import Box from "@mui/system/Box"
import * as React from 'react';
import Table from '@mui/material/Table';
import TableBody from '@mui/material/TableBody';
import TableCell from '@mui/material/TableCell';
import TableContainer from '@mui/material/TableContainer';
import TableHead from '@mui/material/TableHead';
import TableRow from '@mui/material/TableRow';
import {PackageDistribution} from './types';

interface PackagesListProps {
children: React.ReactNode;
}
function formatAddress (row: PackageDistribution)
{

return <>{row.address} {row.postcode} {row.city} {row.country} {row.lat} {row.lng}</>
}


const PackagesList = () => {

const [packages, setPackages] = React.useState<PackageDistribution[]>([]);

React.useEffect(
() => {
fetch("https://santa.deployed.space/api/distribution")
.then((response) => response.json())
.then((data) => { setPackages(data) });
}, [])


return (
<>

<TableContainer >
<Table sx={{ minWidth: 80, backgroundColor: "#FFFFFF" }} aria-label="simple table">
<TableHead>
<TableRow>
<TableCell>ID Paczki</TableCell>
<TableCell align="left">Imie i Nazwisko</TableCell>
<TableCell align="left">Adress</TableCell>
</TableRow>
</TableHead>
<TableBody>
{
packages.map((row) => (
<TableRow>
<TableCell>{row.id}</TableCell>
<TableCell>{row.name}</TableCell>
<TableCell>{formatAddress(row)}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</TableContainer>

</>
)
}

export default PackagesList
1 change: 1 addition & 0 deletions src/components/PackagesList/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './PackagesList';
10 changes: 10 additions & 0 deletions src/components/PackagesList/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export interface PackageDistribution {
id: number;
name: string;
address: string;
postcode: string;
city: string;
country: string;
lat: string;
lng: string;
}
12 changes: 12 additions & 0 deletions src/components/PackagingStatus/PackagingStatus.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Box from "@mui/system/Box";
import { useEffect, useState } from "react";
import {DeliveryStatus} from './types';

const PackagingStatus = ({status}: {status:string}) => {
return (
<Box> {status}
</Box>
)
}

export default PackagingStatus;
1 change: 1 addition & 0 deletions src/components/PackagingStatus/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './PackagingStatus';
11 changes: 11 additions & 0 deletions src/components/PackagingStatus/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export interface DeliveryStatus{
id: number
wish_list_id: number
name: string
kindness: number
status: string
country: string
city: string
created_at: string
}

37 changes: 37 additions & 0 deletions src/components/ProgressBar/ProgressBar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { LinearProgress, Typography } from "@mui/material";
import Box from "@mui/system/Box";
import { useEffect, useState } from "react";
import { PackageDistribution } from "./types";

const ProgressBar = () => {
const fetchData = async () => {
const data = await fetch("https://santa.deployed.space/api/distribution/");
const distribution: PackageDistribution[] = await data.json();
setVal(distribution.length);
};
const [val, setVal] = useState<number>(0);

useEffect(() => {
fetchData();
}, []);
return (
<Box width={"210px"}>
<Typography
fontFamily={"roboto"}
fontStyle={"normal"}
fontWeight={400}
fontSize={"16px"}
lineHeight={"150%"}
>
{" "}
Obłożenie sań:{" "}
</Typography>
<Typography align="right"> {Math.floor((val * 100) / 15)}% </Typography>
<Box>
<LinearProgress variant="buffer" value={Math.floor((val * 100) / 15)} />
</Box>
</Box>
);
};

export default ProgressBar;
1 change: 1 addition & 0 deletions src/components/ProgressBar/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './ProgressBar';
13 changes: 13 additions & 0 deletions src/components/ProgressBar/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export interface ProgressBarProps {
children: React.ReactNode;
}
export interface PackageDistribution {
id: number
name: string
address: string
postcode: string
city: string
country: string
lat: string
lng: string
}
99 changes: 99 additions & 0 deletions src/components/SendPresents/SendPresents.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import React from "react";
import { Box, Button, Card, CardContent, Grid, makeStyles, Modal, Paper, styled, Typography } from "@mui/material";
import StarIcon from '@mui/icons-material/Star';
import CloseIcon from '@mui/icons-material/Close';
import ListModal from "../ListModal";


const SendPresents = () =>{

const [open, setOpen] = React.useState(false);
const handleOpen = () => setOpen(true);
const handleClose = () => setOpen(false);

const style = {
position: 'absolute',
top: '50%',
left: '50%',
transform: 'translate(-50%, -50%)',
width: 650,
bgcolor: 'background.paper',
borderRadius: '12px',
boxShadow: 24,
p: 4,
display: 'flex',
padding: '0',
flexDirection: 'column',
};


return (<>
<Button onClick={handleOpen}>Open modal</Button>
<Modal
open={open}
onClose={handleClose}
aria-labelledby="verify-letter-modal"
aria-describedby="verify-letter-modal"
>
<Box sx={style}>
<Grid container spacing={0}>
<Grid item xs={4}>
<Box sx={{ bgcolor: "#F3F7F9", borderTopLeftRadius: 12, borderBottomLeftRadius: 12 }}>
<img style={{ borderTopLeftRadius: 12 }} src="https://s3-alpha-sig.figma.com/img/66c9/766b/c207d69c2b105689d11455c446de3096?Expires=1672012800&Signature=G-bz4llIrnYsmX7~YJnA3JZA8k8Q7iLhFUYmZbQwzpQfof4hejgLIAabKy1d4ranhvKZbrTKCbacGmz179yYdJ2Yp6y25tjYLSyyaiDCfGXDkS8cGjQCgzKDJJy78nHQjBTwfEtXKi7~MX1GY2mH09fltna7UIMFQsMWym7RyG5SUTnOHkfiSCRVMo1qvs0BgXWiBcj7TRu0CQ7xgjdYTI-hcMUSfuqWu7HbmtwPh0hGmtME23Io1ehvQTp99J9GfrJPPB9xsjPNerJKApJG68LmHQEae3iXBXvmfnwgKA8GbMkQy8o0vNcRQ5Q~4Ctd5RhyVwGCUSDIUy1u9O0L3w__&Key-Pair-Id=APKAQ4GOSFWCVNEHN3O4" width="100%" />
<Typography sx={{ padding: 3 }}>
<b>Imię:</b><br />
x<br />
<b>Nazwisko:</b><br />
xxx xxxxxxxx<br />
<b>Wiek:</b><br />
x lat<br />
<b>Grzeczność:</b><br />
x<br />
<b>Kraj:</b><br />
x<br />
<b>Miasto:</b><br />
x<br />
<b>Ulica:</b><br />
x<br />
</Typography>
</Box>
</Grid>
<Grid item xs={8}>
<Box sx={{ borderTopRightRadius: 12, padding: 3 }}>
<Box>
<Grid container spacing={0}>
<Grid item xs={6}>
<Typography sx={{ color: "#A9A9A9", width: "50%" }}>
ID x<br />
calendar xx.xx.xxxx<br />
</Typography>
</Grid>

<Grid item xs={5}>
<Typography sx={{ borderRadius: 12, border: "solid", width: 100, textAlign: "center" }}>
category
</Typography>
</Grid>

<Grid item xs={1}>
<Button variant="text" sx={{ color: "black" }} onClick={handleClose}>
<CloseIcon />
</Button>
</Grid>
</Grid>
</Box>
<Box sx={{ margin: 3 }}>
<Typography sx={{ fontSize: 25 }}>
<ListModal></ListModal>
</Typography>
</Box>

</Box>
</Grid>
</Grid>
</Box>
</Modal>
</>)
}

export default SendPresents
1 change: 1 addition & 0 deletions src/components/SendPresents/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as SendPresents } from './SendPresents';
Loading