Skip to content

Commit

Permalink
prepare for build
Browse files Browse the repository at this point in the history
  • Loading branch information
Zajaczkowskim committed Sep 29, 2024
1 parent 452796d commit a320d21
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 21 deletions.
9 changes: 8 additions & 1 deletion parent_app/src/app/list/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,14 @@ const ImageGallery = () => {
</li>
))} */}
{images.map((image) => (
<Card image={image} waga={image.weight} godzina={convertISOToTime(image.submittedAt)} data={convertISOToDate(image.submittedAt)} />
<Card
key={image._id}
image={image}
waga={image.weight}
godzina={convertISOToTime(image.submittedAt)}
data={convertISOToDate(image.submittedAt)}
face={'1'}
/>
))}
</ul>
</div>
Expand Down
23 changes: 9 additions & 14 deletions parent_app/src/components/Card.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,29 @@
import smile from '../icons/smile.svg';
import sad from '../icons/sad.svg';
import Image from 'next/image';

const Card = ({ image, waga, godzina, data }) => {
const Card = ({ image, waga, godzina, data, face }) => {
return ( <>

<div className="bg-white rounded-lg p-4 mb-4 shadow-md items-center" style={{ width: '350px', height: '150px' }}>
<div>
<p className="text-black">{data}</p>
</div>
<div className="w-full h-full flex">
{/* Left side: Image */}
<div className="w-1/3 h-full">
{/* <img
src={`data:image/png;base64,${image.buffer}`}
alt="Card Image"
className="w-full max-h-full object-cover rounded-md"
style={{ objectFit: 'cover' }}
/> */}
<svg
src="../icons/smile.svg"
alt="Card Image"
className="w-full max-h-full object-cover rounded-md"
style={{ objectFit: 'cover' }}
/>
{face === '1' ? (
<Image src={smile} alt="smile" width={100} height={100} />
) : (
<Image src={sad} alt="sad" width={100} height={100} />
)}
</div>

{/* Right side: Text fields */}
<div className="w-2/3 h-full pl-4 flex flex-col justify-center">
<p className="text-black">Waga: {waga} g</p>
<p className="text-black">Godzina: {godzina}</p>
console.log(`data:image/png;base64,${image.buffer}`);
console.log(face);
</div>
</div>
</div>
Expand Down
7 changes: 1 addition & 6 deletions parent_app/src/utils/dateTimeConverter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ export const convertISOToDate = (isoString: string): string => {
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');

const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
//const seconds = String(date.getSeconds()).padStart(2, '0');

return `${day}-${month}-${year}`;
Expand All @@ -15,10 +13,7 @@ export const convertISOToDate = (isoString: string): string => {
export const convertISOToTime = (isoString: string): string => {
const date = new Date(isoString);

const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');


const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
//const seconds = String(date.getSeconds()).padStart(2, '0');
Expand Down

0 comments on commit a320d21

Please # to comment.