Skip to content

Commit

Permalink
Foodwidget deux (#9)
Browse files Browse the repository at this point in the history
* start on new food widget look

* add img

* use data in new widget

* Add new forecast widget

* Remove old weather widget

* Add launch.json for vscode

* start on new food widget look

* adjust food font size
  • Loading branch information
sverrejb committed Mar 10, 2024
1 parent e481802 commit ccff00b
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@

# End of https://www.toptal.com/developers/gitignore/api/visualstudiocode

.DS_Store
.DS_Store
Binary file added img/wolt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/food/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ fn get_tracking_status(tracking_data: Result<WoltTracking, reqwest::Error>) -> F

FoodTracking {
resturant_name: tracking_data.from_location.name.en.into(),
status: tracking_data.status.into(),
minutes_remaining,
active,
}
Expand Down
56 changes: 51 additions & 5 deletions ui/foodtrackerwidget.slint
Original file line number Diff line number Diff line change
@@ -1,14 +1,60 @@
import { HorizontalBox, VerticalBox } from "std-widgets.slint";
export struct FoodTracking {
resturant_name: string,
minutes_remaining: string,
status: string,
active: bool,
}

export component FoodTrackerWidget{
in property <FoodTracking> tracking;
Text {
font-size: 3rem;
text: "Mat fra " + tracking.resturant_name + " kommer om " + tracking.minutes_remaining + " minutter!";
color: #FEFBE6;
}
Rectangle {
height: 8rem;
background: #FFFFFF;
border-radius: 32px;
HorizontalLayout {
alignment: space-around;
VerticalBox {
Text {
text: "Fra";
color: #1F0D8D;
font-size: 2.5rem;
}
Text {
text: tracking.resturant_name;
color: #000000;
font-size: 2rem;
}
}
VerticalBox {
Text {
text: "Status";
color: #1F0D8D;
font-size: 2.5rem;
}
Text {
text: tracking.status;
color: #000000;
font-size: 2rem;
}
}
VerticalBox {
Text {
text: "ETA";
color: #1F0D8D;
font-size: 2.5rem;
}
Text {
text: tracking.minutes-remaining + " minutter";
color: #000000;
font-size: 2rem;
}
}
Image {
source: @image-url("../img/wolt.png");
width: 100px;
}

}
}
}
50 changes: 24 additions & 26 deletions ui/mainwindow.slint
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export component MainWindow inherits Window {
};

in property <FoodTracking> foodTracking: {
active: true,
active: false,
resturant_name: "McDonalds",
minutes_remaining: "5",

Expand All @@ -42,6 +42,9 @@ export component MainWindow inherits Window {
default-font-family: "Bagoss";

VerticalLayout{
width: 100%;
padding-left: 2rem;
padding-right: 2rem;
alignment: space-between;

ForecastWidget { today: todayForecast; tomorrow: tomorrowForecast;}
Expand All @@ -55,35 +58,30 @@ export component MainWindow inherits Window {
xkcd: xkcd;
}

HorizontalBox {
HorizontalLayout {
width: 100%;
alignment: space-between;
VerticalLayout {
alignment: end;
spacing: -3px;
padding-bottom: 6px;
Text {
font-size: 2.4rem;
font-weight: 700;
horizontal-alignment: center;
color: #FEFBE6;
text: date;
VerticalLayout {
spacing: -3px;
padding-bottom: 6px;
Text {
font-size: 2.4rem;
font-weight: 700;
color: #FEFBE6;
text: date;
}
Text {
font-size: 1.1rem;
color: #FEFBE6;
text: month;
}
}
Text {
font-size: 1.1rem;
horizontal-alignment: center;
color: #FEFBE6;
text: month;
font-size: 4rem;
text: time;
font-family: "Fira Mono";
}
}

Text {
color: #FEFBE6;
horizontal-alignment: right;
font-size: 4rem;
text: time;
font-family: "Fira Mono";
}
}

}
}
}

0 comments on commit ccff00b

Please sign in to comment.