From 9c713a1be74ba0265858c8d620c153ab58a54e3467781ad18ad1d822571a5de6 Mon Sep 17 00:00:00 2001 From: Techognito Date: Fri, 5 Sep 2025 18:06:19 +0200 Subject: [PATCH] Fixed some menu stuff, and added vehicle summary --- src/.index.tsx.swp | Bin 12288 -> 12288 bytes src/GarageApp/.App.tsx.swp | Bin 12288 -> 12288 bytes src/GarageApp/App.tsx | 4 +- src/GarageApp/i18n.js | 2 +- src/GarageApp/modules/.MenuBar.tsx.swp | Bin 16384 -> 20480 bytes src/GarageApp/modules/.MenuLanguages.tsx.swp | Bin 0 -> 12288 bytes src/GarageApp/modules/.StatisticsView.tsx.swp | Bin 16384 -> 16384 bytes .../modules/.VehicleCardSummary.tsx.swp | Bin 0 -> 12288 bytes src/GarageApp/modules/.VehicleCards.tsx.swp | Bin 0 -> 12288 bytes src/GarageApp/modules/.YourVehicles.tsx.swp | Bin 12288 -> 12288 bytes src/GarageApp/modules/MenuBar.tsx | 43 ++++++--- src/GarageApp/modules/MenuLanguages.tsx | 2 +- src/GarageApp/modules/StatisticsView.tsx | 2 - src/GarageApp/modules/VehicleCardSummary.tsx | 86 ++++++++++++++++++ src/GarageApp/modules/VehicleCards.tsx | 8 +- src/GarageApp/modules/YourVehicles.tsx | 9 +- src/index.tsx | 11 ++- 17 files changed, 143 insertions(+), 24 deletions(-) create mode 100644 src/GarageApp/modules/.MenuLanguages.tsx.swp create mode 100644 src/GarageApp/modules/.VehicleCardSummary.tsx.swp create mode 100644 src/GarageApp/modules/.VehicleCards.tsx.swp create mode 100644 src/GarageApp/modules/VehicleCardSummary.tsx diff --git a/src/.index.tsx.swp b/src/.index.tsx.swp index 4747b7cc771f68e5d3950b42f8c1d41e54cf7f88fa02cf3358c207a15bb6c767..2fc0c4616260570eb835297bcfcc6ddfd161d7bd87757fc45411c9d1cc1feba7 100644 GIT binary patch delta 570 zcmb8rK}eHv7{~EP=S(Zz1k3P{e^I8JF`Yu-)Ifbb44s0C&`GzwZ|$YGZEj{l#Kem? zJ-i^)K~O=ARY9rEfAKJerDKk&eRc4Bs-D&8^{iK_Ns zNQhUY=IC?s)8WC#s!LBn+^O*X@|5klM0EGR=eS*=Ugq<+MdG-)C31={c#l=AAcZJe zaCuYYC%$46Ygk1FLukeCQjs%!#|ON_1`KGZLot?0L>5XUFD9iIo#;RqK6r3?Lu4Ng zHn5C&B%z@RHMk28%5hvQvWs=hVFr`1@C+gR;R{ai!+lR=o3e&wyu};nZl|DV(bbl? ze(d|cN6t6jPGPMT%S}BoE$c4loEIo39B8Q-chL%VuFptL+N`taS{SHP*Pz`Nu zam1*hpe<^!q1y)#+PjcT^h7WGrgwTuiBiIwR2S#w6@4@$%q`ORsAZ}TPiNj{PfOhL zxZiua2OJ{%ZU1+?>```$=`N8O4B@I%q=qu`$Y2d&^x~^S0)fBDPsLBw*{EB122KUGfoC#;meX|ryJpKZEJVZor0&uwihg=|WhRD9#QsjI4P i1|q5%3WUd^(Lgepjs`T{jF@U#GqjZ9vyMkrTYmwW!A$D_ diff --git a/src/GarageApp/.App.tsx.swp b/src/GarageApp/.App.tsx.swp index ec17a0a77d1a2df5a37811d945af45b9f517f3d59ef0fc6cb8c652d6280a4dc2..cb723411be2fca56ec36e85989bc7efb7cb6b9befecd488e837fbe04f4c01840 100644 GIT binary patch delta 133 zcmZojXh;xGG6?hZRj|}EWB>vI1_mFl-5LLwZ)_C5#LQY+lBR31`5m(o52M0nL4nWw zyw*Gn43~izq*7tBphB{u4=)3QArPwo@h_mvdmw%V#4mvOIS^moJW;`pXYxCp2o8Ox W{0ch;1%=7>x(dud_U16%RZIY(vLSH* delta 127 zcmZojXh;xGG6?hZRj|}EWB>vI28QxmYctd{uWl5-#5^&9b@MxBB_2k(&4L1-`FZ1b z7#Q9GF-V!*WI=^wIeT6P22mj90%BGmW(Hy=AO@*=%d=TgAckl1Wt|9t;F83W%;J*F R - + + + ); diff --git a/src/GarageApp/i18n.js b/src/GarageApp/i18n.js index d0ca8cbd..512a85cb 100644 --- a/src/GarageApp/i18n.js +++ b/src/GarageApp/i18n.js @@ -11,7 +11,7 @@ i18n .use(initReactI18next) .init({ fallbackLng: 'en', - debug: true, + debug: false, backend: { loadPath: '/GarageApp/locales/{{lng}}/{{ns}}.json' }, diff --git a/src/GarageApp/modules/.MenuBar.tsx.swp b/src/GarageApp/modules/.MenuBar.tsx.swp index 70ca4ca80254927ae835237aa649f49979b13c29cb1571ab2846e219676029df..1309b6c49bb802dba6e5df78f5a33c17ab0e77e6d7d93d2c863eec368eac3af3 100644 GIT binary patch delta 1795 zcma*nUrbw79Ki8Y3XBd|(L%`nB%YNCloZPTJTRbz>0;dsKKN&UVrEjx1)8<@mU8Qa z+LUcC>Vu11pZr6XVL~)+#&pchMSU=F#>9v1L8meM7c~nK_nfN{Q7Sb&-p7e9i zxu@sP@1A?lnVND;opdw~cJA9VAa{0b6{I>LcCWoSy5PL}LE{x?McN#0@5=w;tgmr9 zMUMZ=R3p+}>%O{1UwPq1^x64#J9pT*)6SdoTkGC;Ps{S!nMxt9t)ZHU7(-sn9bYTN zer&{|ONa$rz6iCt*KZxup(iT5yrP)J)wszDoWmsI2%{Y5SjX4# zVp%;CQ;1?c{$S~DIPy0(|5&k8WQCOce4tR0O8)8%3}||KkEta>%T29BkIbcFBco=E z%w|IwQ?}}ngyzfk2A-No8Y8Jla&)55v~ZO&Y9x||uIXmb8}Tj=BBh}}9FIj02Qzjd ztAbJKur?9Qa9ODsO=-iyjJm40r0gBg?k@zSx}-ESozh!{b=Bv~4X5>}88dXLLVhT1 znub2!no&dg?P>gK9KQ-!W_>avL?Cbou8gYcmMsZ7cEpVlBWJmEX~UEI#MyM7(q*E-D+3=U42Il-gPl-byFI1A>w3Y zL>pJ(=BL|I6}flVeFv)x`?A^o(w5xp7<`0R@F@OX#}2|J%)^3-$I%Hl7HWm~7N24U zSsXwZo3K!Te2#gX!U-J33z&oovJcIu!6Jcwk2j#>$^2KH zM_g{LG+EDfZ$vwG)oIVGS0RVA;Yd1e$|tCl*nstRe$@J_JDfk*bKRMX3<+_PBjGIP zg*vs0XWcDU;|kuz9H!BaMONTv%wiI0_)&&`c=|i|1|Q=*KE$hd4r53{!z0*H%lYJ? z@EI#Ji9v)>j|HCo65c`%W7vmYw4oY5u_9mKZA`(y)7SwIe&sN|hO>AH1L(sBT;Kqm ztCGB93hH$2LIc!FsMGXigxBO9<-SU5TTi1ySdTRYtoa_#W;Xq5$}E3sE*FQw%8s`l zXlkfX^&QsbK2Nh$A9HZIVTUSarP}Lug(_xcAf$$Gx9)@*tZwh%y8jw)%l{cKA8xu` F`7f*3m(KtI delta 809 zcmXZZT}YEr9LMpq&8^J6D4DBSahw;k5?=;^ZHi%p*)S3!2vgKGbWDBLHZ?KXf)eQ> zn#U{Y#S23UN#rT8x~ZE8tQ&iQB+!bApcn8$>#Dvh4}2cZ^FQbLbDrNxO&U@ugR`UJ zWJ9AoP*y1zxk7wxyVtce{d&&1XiB%4^&h5utHUUgEE+RA7*Um%>&!O&e-UMRQ|_!I zy&}hCmTe2g4+b7IVw-%FY@<|;JQ(mcTZlJ!0u6<5VR5q%w=sogRH797V8ORdLVUqz zJjN|d;wHw?hal>(YM~d>7S7$z| z)*DaAXnSWUE^B17=ZMx5@{~$XQ(rh3k%xN|v2ZA!DKzv%wOGQ_;@8La#>~kpMAu5J znZV07Zse1LlVAXyIF2fmz=>765KobU7X|oZ6XH7-FoO|vp&oAJVcp8r;XbY+X%$Ds z2__|QVJ(N)5J3w9@ZvWIT*d+(VjANZ!38AIs=ufh$WE`gRIT5oMtxh=Ghe=%@E=s8 zZo9hUwyGt6y`fsoxVP&?)ypO|;kFyA%hjU=W2$AWY3^a zdP`+c>(*jE=^5w>Co-X)3CE+|?W}n^y0u`$BZvQec|EX8RTbORO0mNxWh69Mv(fc0 Dk$|Qq diff --git a/src/GarageApp/modules/.MenuLanguages.tsx.swp b/src/GarageApp/modules/.MenuLanguages.tsx.swp new file mode 100644 index 0000000000000000000000000000000000000000000000000000000000000000..2673ec8303b3abd63d59d52b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Fr$*uYE z=7me$vRDH{iNxe%eSE-tGt zYOBTL23>tRsO!X3hV<#|0MchgS(iQI+jiYUWbn_NNR+&6Jw@H;HLI6_u0bs{g4yD05XgGS9a4X|8q6 Q$nY7;;w*v3qlEgu0T$hf_y7O^ literal 0 HcmV?d00001 diff --git a/src/GarageApp/modules/.StatisticsView.tsx.swp b/src/GarageApp/modules/.StatisticsView.tsx.swp index 3b15b2b181d491072af488efe5ae9c3e7dc4fd6c695cc02cd37ff2d6878c4879..a6fe565cea2be47727e142fa05098aa7ec79f6c71294a224690051b15d38dfad 100644 GIT binary patch delta 240 zcmZo@U~Fh$6i+e;^Ym4))H7rN0s#gFPp;h=-%bZt^)BHAkGD1Js{==;AG6^LDd_!Toc|uK2*lzzlTGW=57} ytn#(BwG0Xhn$|$VM&CIhk&ccA2|)oOAn^~-PypYV*}L1sc2c=OnUz1@AM@tTd*3&+ zE6cOkzI5(II^~WL9Qz2F-}UvclXTEIZF@i`6@fZ=0+F_qGCi$i(iOB*a!B4U-l648CU_!;8idUJn;Q)_y?bWcR&K>!Smo0I0;UG3D5*P!Cwy( z@;kTzz6IZa&%xW^4X_Ai!4z=80r2lGLjC|hfiJ+P;6tzq67UK*51s)xcM|e0SOWrt z;37B$o&r0--wzS;1NaVn2|fbvf$QKLm;>X0f_-2IAmAV9t2Ew?>pzv&_OJ?A1*`&A z0jt2)D8N_qOi1jk3t1UUx_-OdH0cpao74D3>5Lad%X9kD+@2LtFuYd==E+WV`4Y>y zm?OAuHhVK(j!X4CpX-KE9GAJ91=#}j@dZ)Zp$BP$UP~I4oiPiTWNyN8$1xq6basw9 z%Hd4qTSZ}x88t91qSyIs13Lm&8g~n;-%*`aOp-by2q@u_i;-sUmmdZ$CcVl)YTIGQ= z-qeyFhpY!_=%Nw}Wg5waTtq&vS@jw^(cwsaw=$C~USJ6}SIU~b_G*0kr4T&z*G$dU zdqDZPTjX&hod#`;j`b%2M$pp;b?nwkyyex6Ss~3t+M@cJv?vu^mLkPWrBp4R!2?XQ z^O;;y(|w+Iux*wL9#ry2A$9g^HDq={3fMT!Che|sp_Dr~wa;YER6uc(4* zQwvr3(rwDYh8|wX^r~}R_tsvqd2R;AOfIsRyK&ZWRAf!Ksy}Ni#tc8nVxDyJj5Sny zZ9hV(s@>ym=_TGQlG(bEkR|h zjywC(k?1V?o=h@$_aR0)OW6vGBvoc-ROHUp+HPW&N1mBEg?FG^MnMm!WwW(d-3({e z)jSzRXzXZ;s?1Vk za8Y0%c+6Cqs_KK3*MC-=E*;Z9djIG=AhrYjH6=(wdy&hj}}k z^d|$qK}eM7Z)f+m%tz@;B$sMZj8c6AkwTFrbi{03SGw_4IWpb%b8_(EFlNV-GV&5s oS41rK2Cc&m`WsmJywzB@3=Q?CaU-XyVQBU&W~!N3^+3`7AIxdcTL1t6 literal 0 HcmV?d00001 diff --git a/src/GarageApp/modules/.VehicleCards.tsx.swp b/src/GarageApp/modules/.VehicleCards.tsx.swp new file mode 100644 index 0000000000000000000000000000000000000000000000000000000000000000..a6b2755b595821782db56914bc1971c8319499090981a0de1e3704180a438836 GIT binary patch literal 12288 zcmeI2ONRA zqi0M6O}u#_F~+kddO?jQ8ug$?Paf2m5XHpc<7C8W{8v@?bPvpG;>~PN^4po|`X2TD z>+7x|)O`K;!NYW?F;4K>M98rXmpUWszFd3p++Bp94eU_Z%nP|EhgW(n)+V>r>$MiQ z{D7@wgzHb|1DbnT)AyQ=A6e!OgIaunJAT*Yo-hN>nxfWq*m67YBhNC!plKdp0c-O; z-LC2SR^;%|JkC3I)8Vr$utGzGOaG9$7%CK4zyM{c2lGi3>carxt*S#lSi?>37LV-eoLV-eo zLV-eoLV-eoLV-eoLV-eoLV^FG0?Z<0{Y`|ty$+Md|Np1|{{Qw)LS6&Uf)n5Y@ar9f zyak>E^MHXJ;HQm*Tml!sdGHvx7hJuakPpH0-~u=R_JcXF4{QQ|-bTnD;2QWHya!$a zi(noc0{4K+8wmLtd`(Rqz6M3hV}3!8NSOW$-!p0K5y{0dl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a00370718ec564143b..25b446b9f2813c1b1ffaea93b7ee919c1816b39d99e12fd5d49fb00e97247842 100644 GIT binary patch delta 300 zcmZojXh;xGG6?hZRj|}EWB>vI1_pPo-5KwgZ)_C*$KG3W&LY z_&pB;!xA8#0>o`VoDamoK&%hM8bHhj#Lu`H7#;%gE+7s7;vI28O=nJ2UG2u5T3o$d zK?UXd?R*RjjbxtfwQOL_oMzWIyWa;F;n&Ff8X;p0Y)&9*i*;jAQ=GS_ni~zVHQ+NOX diff --git a/src/GarageApp/modules/MenuBar.tsx b/src/GarageApp/modules/MenuBar.tsx index e5f3aaae..657df543 100644 --- a/src/GarageApp/modules/MenuBar.tsx +++ b/src/GarageApp/modules/MenuBar.tsx @@ -43,8 +43,35 @@ function GarageAppLogo() { ) } -const pages = ['Home', 'Quick Entries', 'Import']; +const pages = [ + {name: 'menu.home',key: "home",href: "/"}, + {name: 'menu.quickentries',key: 'quickentries',href: "/"}, + {name: 'menu.import',key: 'import',href: "/"} +] const settings = ['Profile', 'Admin', 'Logout']; + +//const settings = [ +// {name: 'menu.settings',key: "profile",href: "/"}, +// {name: 'menu.admin',key: 'admin',href: "/"}, +// {name: 'menu.logout',key: 'logout',href: "/"} +//] + +function MenuButtons({ key,onClick,href,name }) { + const { t, i18n } = useTranslation(); + + return( + + {t (name)} + + ) + +} + function ResponsiveAppBar() { //translation const { t, i18n } = useTranslation(); @@ -101,21 +128,13 @@ function ResponsiveAppBar() { sx={{ display: { xs: 'block', md: 'none' } }} > {pages.map((page) => ( - - {page} - + ))} {pages.map((page) => ( - + ))} @@ -145,9 +164,7 @@ function ResponsiveAppBar() { {setting} ))} - - diff --git a/src/GarageApp/modules/MenuLanguages.tsx b/src/GarageApp/modules/MenuLanguages.tsx index 4dbd32f0..32c5e239 100644 --- a/src/GarageApp/modules/MenuLanguages.tsx +++ b/src/GarageApp/modules/MenuLanguages.tsx @@ -49,7 +49,7 @@ export default function LanguageMenu( {closeAction} ) { return ( - + - @@ -161,7 +160,6 @@ export default function StatisticsView() { - ); } diff --git a/src/GarageApp/modules/VehicleCardSummary.tsx b/src/GarageApp/modules/VehicleCardSummary.tsx new file mode 100644 index 00000000..9343cbb7 --- /dev/null +++ b/src/GarageApp/modules/VehicleCardSummary.tsx @@ -0,0 +1,86 @@ +import * as React from 'react'; +import Grid from '@mui/material/Grid'; +import Paper from '@mui/material/Paper'; +import Container from '@mui/material/Container'; +import { useTranslation, withTranslation, Trans } from 'react-i18next'; + +const uid = "39e9009e-50e1-4277-bbf7-69e5e0f6c6dc" + +async function DataFetch(url) { + const response = await fetch(url); + const data = await response.json(); + return data; +} + +function VehicleCardSummary({ vehicleid }) { + const { t, i18n } = useTranslation(); + + const [data, setData] = React.useState(null); + const [loading, setLoading] = React.useState(true); + const [error, setError] = React.useState(null); + + React.useEffect(() => { + async function fetchData() { + try { + const data = await DataFetch(`/GarageApp/api/fillups/${uid}/${vehicleid}/lastfillup`); + setData(data); + setLoading(false); + } catch (error) { + setError(error); + setLoading(false); + } + } + + + fetchData(); + }, []); + console.log("blablambpmgpoa") + console.log(data) + if (loading) { + return
Loading...
; + } + + if (error) { + return
Error: {error.message}
; + } + if (!data.toString()) { + return

Nothing Registered

+ } + return ( +
+ + + +

{t ('lastfillup')}:

+
+
+ + + {data.map((f) => ( +
+

{f.date.split(" ",1)}

+

{f.total_amount.toFixed(2) + " " + f.currency}

+

{f.fuel_quantity.toFixed(2) + " @ " + f.per_unit_price.toFixed(2)}"

+
+ ))} +
+
+
+ + + +

{t ('odometer')}:

+
+
+ + +

{data.map((fillup) => ( +

{fillup.odo_reading + " km"}

+ ))}

+
+
+
+
+ ); +} +export default VehicleCardSummary; diff --git a/src/GarageApp/modules/VehicleCards.tsx b/src/GarageApp/modules/VehicleCards.tsx index 20f4ddcf..5c6a8d5d 100644 --- a/src/GarageApp/modules/VehicleCards.tsx +++ b/src/GarageApp/modules/VehicleCards.tsx @@ -17,10 +17,12 @@ import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; import MoreVertIcon from '@mui/icons-material/MoreVert'; import GasStation from './icons/gasFillup' import Expense from './icons/Expense' +import VehicleCardSummary from "./VehicleCardSummary"; import { useTranslation, withTranslation, Trans } from 'react-i18next'; + interface ExpandMoreProps extends IconButtonProps { expand: boolean; } @@ -50,7 +52,7 @@ const ExpandMore = styled((props: ExpandMoreProps) => { ], })); -export default function VehicleCard({ nickname, makemodel, registration}) { +export default function VehicleCard({ nickname, makemodel, registration, vehicleID}) { const { t, i18n } = useTranslation(); const [expanded, setExpanded] = React.useState(false); @@ -93,9 +95,7 @@ export default function VehicleCard({ nickname, makemodel, registration}) { - - Expanded area… - + diff --git a/src/GarageApp/modules/YourVehicles.tsx b/src/GarageApp/modules/YourVehicles.tsx index ffccddb8..b7cee96a 100644 --- a/src/GarageApp/modules/YourVehicles.tsx +++ b/src/GarageApp/modules/YourVehicles.tsx @@ -5,9 +5,16 @@ import VehicleCard from "./VehicleCards"; import Button from '@mui/material/Button'; import { useTranslation, withTranslation, Trans } from 'react-i18next'; + + const uid = "39e9009e-50e1-4277-bbf7-69e5e0f6c6dc" const response = await fetch(`/GarageApp/api/vehicles/${uid}`); const vehicles = await response.json(); + + + + + export default function YourVehicleList() { const { t, i18n } = useTranslation(); return ( @@ -29,7 +36,7 @@ export default function YourVehicleList() { }}> {vehicles.map((vehicle, index) => ( - + ))} diff --git a/src/index.tsx b/src/index.tsx index 0e89c00f..1df02fc2 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -26,7 +26,6 @@ const server = serve({ return new Response(Bun.file(path)) }, "/GarageApp/api/vehicles/:uid": async req => { - //const uid = "39e9009e-50e1-4277-bbf7-69e5e0f6c6dc" const uid = req.params.uid; const query = db.query( `SELECT * FROM vehicles WHERE id IN (SELECT vehicle_id FROM user_vehicles WHERE user_id='${uid}');` @@ -53,6 +52,16 @@ const server = serve({ return Response.json(fillups) }, + "/GarageApp/api/fillups/:uid/:vid/lastfillup": async req => { + const uid = req.params.uid; + const vid = req.params.vid; + const query = db.query( + `SELECT * FROM fillups WHERE user_id='${uid}' AND vehicle_id='${vid}' ORDER BY odo_reading DESC LIMIT 1;` + ); + const lastfillup = query.all(); + return Response.json(lastfillup) + }, + "/api/hello": { async GET(req) {