Skip to content

Commit

Permalink
One time tips
Browse files Browse the repository at this point in the history
  • Loading branch information
danielchalmers committed Jan 24, 2024
1 parent 8d382a0 commit 1e07b64
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
13 changes: 13 additions & 0 deletions JournalApp/Components/Pages/ManageCategoriesPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
@inject IDialogService DialogService
@inject KeyEventService KeyEventService
@inject NavigationManager NavigationManager
@inject ISnackbar Snackbar

<div class="page-title">
<div class="page-header">
Expand Down Expand Up @@ -57,6 +58,16 @@
KeyEventService.Entered(() => Submit());
}

protected override async Task OnAfterRenderAsync(bool firstRender)
{
await base.OnAfterRenderAsync(firstRender);

if (firstRender)
{
Snackbar.ShowOneTimeTip("add_new_category", $"Click the '+' icon to add a new one");
}
}

async Task MoveUp(DataPointCategory category)
{
await db.MoveCategoryUp(category);
Expand Down Expand Up @@ -121,5 +132,7 @@
db.SaveChanges();
db.Dispose();
}

Snackbar.Clear();
}
}
10 changes: 7 additions & 3 deletions JournalApp/Components/Pages/MoodGrid/MoodGridPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,14 @@
{
await base.OnAfterRenderAsync(firstRender);

Snackbar.ShowOneTimeTip("click_mood_grid_day", "Click a day to go to it");
if (firstRender)
{
Snackbar.ShowOneTimeTip("click_mood_grid_day", "Click a day to go to it");
}
}

async Task ScrollToMonth(int month)
{
async Task ScrollToMonth(int month)
{
logger.LogDebug($"Scrolling to month {month}");

await JSRuntime.InvokeVoidAsync("scrollToTopOfNestedElement", ".mood-grid", $"#mood-grid-month-{month}");
Expand Down Expand Up @@ -216,5 +219,6 @@
public void Dispose()
{
KeyEventService.Exited();
Snackbar.Clear();
}
}
9 changes: 8 additions & 1 deletion JournalApp/Data/AppDataService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,15 @@ public async Task StartExportWizard(IDialogService dialogService)
var sw = Stopwatch.StartNew();

var preferenceBackups = new List<PreferenceBackup>();
foreach (var key in new[] { "safety_plan", "mood_palette", })
foreach (var key in new[] {
"safety_plan",
"mood_palette",
"help_click_mood_grid_day",
"help_add_new_category",
})
{
preferenceBackups.Add(new(key, Preferences.Get(key, string.Empty)));
}

BackupFile backupFile;
await using (var db = await dbFactory.CreateDbContextAsync())
Expand Down
1 change: 1 addition & 0 deletions JournalApp/MauiProgram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public static MauiApp CreateMauiApp()
c.SnackbarConfiguration.NewestOnTop = true;
c.SnackbarConfiguration.HideTransitionDuration = 300;
c.SnackbarConfiguration.ShowTransitionDuration = 300;
c.SnackbarConfiguration.VisibleStateDuration = 8_000;
c.SnackbarConfiguration.SnackbarVariant = Variant.Text;
});

Expand Down

0 comments on commit 1e07b64

Please sign in to comment.