Skip to content

Commit

Permalink
fix: Minor issues
Browse files Browse the repository at this point in the history
  • Loading branch information
TomBursch committed Oct 4, 2024
1 parent 33ab6e7 commit 20a1784
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 31 deletions.
4 changes: 1 addition & 3 deletions backend/app/service/recipe_scraping.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import hashlib
import re
from recipe_scrapers import scrape_html
from recipe_scrapers._exceptions import SchemaOrgException
Expand Down Expand Up @@ -162,8 +161,7 @@ def scrape(url: str, household: Household) -> dict | None:

if (
kitchenowlMatch
and hashlib.sha256(res.text.encode()).hexdigest()
== "87d851b8a5949da174eb8f43579438242ae2119f0a6cac0718884c52f2a77124"
and "<title>KitchenOwl</title>" in res.text
):
return scrapeKitchenOwl(
url, kitchenowlMatch.group(1) + "/api", int(kitchenowlMatch.group(2))
Expand Down
7 changes: 5 additions & 2 deletions kitchenowl/lib/pages/household_page/planner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,17 @@ class _PlannerPageState extends State<PlannerPage> {
if (state.recipePlans.isEmpty)
SliverToBoxAdapter(
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 16),
padding: const EdgeInsets.all(16),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Icon(Icons.no_food_rounded),
const SizedBox(height: 16),
Text(AppLocalizations.of(context)!.plannerEmpty),
Text(
AppLocalizations.of(context)!.plannerEmpty,
textAlign: TextAlign.center,
),
],
),
),
Expand Down
19 changes: 13 additions & 6 deletions kitchenowl/lib/pages/recipe_add_update_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,12 @@ class _AddUpdateRecipePageState extends State<AddUpdateRecipePage> {
context)!
.private +
" ",
style: TextStyle(
fontWeight:
FontWeight.bold),
style: Theme.of(context)
.textTheme
.bodyMedium
?.copyWith(
fontWeight:
FontWeight.bold),
),
TextSpan(
text: AppLocalizations.of(
Expand All @@ -339,9 +342,13 @@ class _AddUpdateRecipePageState extends State<AddUpdateRecipePage> {
context)!
.public +
" ",
style: TextStyle(
fontWeight:
FontWeight.bold),
style: Theme.of(context)
.textTheme
.bodyMedium
?.copyWith(
fontWeight:
FontWeight.bold,
),
),
TextSpan(
text: AppLocalizations.of(
Expand Down
40 changes: 20 additions & 20 deletions kitchenowl/lib/pages/recipe_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,26 @@ class _RecipePageState extends State<RecipePage> {
imageHash: state.recipe.imageHash,
popValue: () => cubit.state.updateState,
actions: (isCollapsed) => [
if (state.recipe.public)
Padding(
padding: const EdgeInsets.only(right: 8),
child: LoadingIconButton(
tooltip: AppLocalizations.of(context)!.share,
variant: state.recipe.image == null ||
state.recipe.image!.isEmpty ||
isCollapsed
? LoadingIconButtonVariant.standard
: LoadingIconButtonVariant.filledTonal,
onPressed: () async {
final uri = Uri.tryParse(App.currentServer +
'/recipe/${widget.recipe.id}');
if (uri == null) return;

Share.shareUri(context, uri);
},
icon: Icon(Icons.adaptive.share_rounded),
),
),
if (!App.isOffline && state.isOwningHousehold(state))
Padding(
padding: const EdgeInsets.only(right: 8),
Expand Down Expand Up @@ -462,26 +482,6 @@ class _RecipePageState extends State<RecipePage> {
icon: const Icon(Icons.edit),
),
),
if (state.recipe.public)
Padding(
padding: const EdgeInsets.only(right: 8),
child: LoadingIconButton(
tooltip: AppLocalizations.of(context)!.share,
variant: state.recipe.image == null ||
state.recipe.image!.isEmpty ||
isCollapsed
? LoadingIconButtonVariant.standard
: LoadingIconButtonVariant.filledTonal,
onPressed: () async {
final uri = Uri.tryParse(App.currentServer +
'/recipe/${widget.recipe.id}');
if (uri == null) return;

Share.shareUri(context, uri);
},
icon: const Icon(Icons.share_rounded),
),
),
],
),
SliverCrossAxisConstrained(
Expand Down

0 comments on commit 20a1784

Please sign in to comment.