Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed Nov 6, 2023
1 parent b6cda1b commit f93064a
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 30 deletions.
20 changes: 6 additions & 14 deletions MyApp/Components/Identity/StatusMessage.razor
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@using MyApp.Identity
@using MyApp.Identity

@{
var message = Message ?? MessageFromCookie;
Expand All @@ -14,34 +14,34 @@
<div class="alert">
@if (message.StartsWith("Error"))
{
<div class="rounded-md bg-red-50 p-4">
<div class="rounded-md bg-red-50 dark:bg-red-900 p-4">
<div class="flex">
<div class="flex-shrink-0">
<svg class="h-5 w-5 text-red-400" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.28 7.22a.75.75 0 00-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 101.06 1.06L10 11.06l1.72 1.72a.75.75 0 101.06-1.06L11.06 10l1.72-1.72a.75.75 0 00-1.06-1.06L10 8.94 8.28 7.22z" clip-rule="evenodd" />
</svg>
</div>
<div class="ml-3">
<h3 class="text-sm font-medium text-red-800">@message</h3>
<h3 class="text-sm font-medium text-red-800 dark:text-red-100">@message</h3>
</div>
</div>
</div>
}
else
{
<div class="rounded-md bg-green-50 p-4">
<div class="rounded-md bg-green-50 dark:bg-green-900 p-4">
<div class="flex">
<div class="flex-shrink-0">
<svg class="h-5 w-5 text-green-400" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd" />
</svg>
</div>
<div class="ml-3">
<p class="text-sm font-medium text-green-800">@message</p>
<p class="text-sm font-medium text-green-800 dark:text-green-100">@message</p>
</div>
<div class="ml-auto pl-3">
<div class="-mx-1.5 -my-1.5">
<button type="button" class="inline-flex rounded-md bg-green-50 p-1.5 text-green-500 hover:bg-green-100 focus:outline-none focus:ring-2 focus:ring-green-600 focus:ring-offset-2 focus:ring-offset-green-50">
<button onclick="this.closest('.alert').classList.add('hidden')" type="button" class="inline-flex rounded-md bg-green-50 dark:bg-green-900 p-1.5 text-green-500 hover:bg-green-100 focus:outline-none focus:ring-2 focus:ring-green-600 focus:ring-offset-2 focus:ring-offset-green-50">
<span class="sr-only">Dismiss</span>
<svg class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
<path d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z" />
Expand All @@ -53,14 +53,6 @@
</div>
}
</div>
<script type="module">
import { on } from "@@servicestack/client"
on('.alert button', {
click: e => {
e.target.closest('.alert').classList.add('hidden')
}
})
</script>
}

@code {
Expand Down
4 changes: 2 additions & 2 deletions MyApp/Configure.Db.Migrations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ public void Configure(IWebHostBuilder builder) => builder
using (var scope = scopeFactory.CreateScope())
{
using var db = scope.ServiceProvider.GetRequiredService<ApplicationDbContext>();
var dbJustCreated = db.Database.EnsureCreated();
db.Database.EnsureCreated();
db.Database.Migrate();

// Only seed users if DB was just created
if (dbJustCreated)
if (!db.Users.Any())
{
log.LogInformation("Adding Seed Users...");
AddSeedUsers(scope.ServiceProvider).Wait();
Expand Down
6 changes: 6 additions & 0 deletions MyApp/MyApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@
<ProjectReference Include="..\MyApp.ServiceModel\MyApp.ServiceModel.csproj" />
</ItemGroup>

<ItemGroup>
<Content Include="_pages\**" CopyToPublishDirectory="PreserveNewest"/>
<Content Include="_posts\**" CopyToPublishDirectory="PreserveNewest"/>
<Content Include="_videos\**" CopyToPublishDirectory="PreserveNewest"/>
</ItemGroup>

<ItemGroup>
<Folder Include="App_Data\" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion MyApp/Pages/Account/Login.razor
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<div class="flex items-center justify-between">
<div class="flex items-center">
<InputCheckbox id="remember-me" @bind-Value="Input.RememberMe" class="@Css.Checkbox" />
<label for="remember-me" class="ml-2 block text-sm text-gray-900 select-none">Remember Me</label>
<label for="remember-me" class="ml-2 block text-sm text-gray-900 dark:text-gray-50 select-none">Remember Me</label>
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion MyApp/Pages/Account/LoginWith2fa.razor
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<div class="flex items-center justify-between">
<div class="flex items-center">
<InputCheckbox id="remember-machine" @bind-Value="Input.RememberMachine" class="@Css.Checkbox" />
<label for="remember-machine" class="ml-2 block text-sm text-gray-900 select-none">
<label for="remember-machine" class="ml-2 block text-sm text-gray-900 dark:text-gray-50 select-none">
Remember this machine
</label>
</div>
Expand Down
2 changes: 1 addition & 1 deletion MyApp/Pages/Account/Manage/SetPassword.razor
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<div>
<label for="new-password" class="@Css.InputLabel">New password</label>
<div class="mt-1 relative rounded-md shadow-sm">
<InputText id="new-password" type="password" @bind-Value="Input.NewPassword" class="form-control" autocomplete="new-password" placeholder="Please enter your new password." />
<InputText id="new-password" type="password" @bind-Value="Input.NewPassword" class="@Css.InputText" autocomplete="new-password" placeholder="Please enter your new password." />
</div>
<ValidationMessage For="() => Input.NewPassword" class="@Css.ValidationMessage" />
</div>
Expand Down
2 changes: 1 addition & 1 deletion MyApp/wwwroot/css/typography.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
border-left-style: solid;
}

.dark :not(:where([class~="not-prose"] *)), .dark .prose :where(td):not(:where([class~="not-prose"] *)) {
.dark .prose :not(:where([class~="not-prose"] *)), .dark .prose :where(td):not(:where([class~="not-prose"] *)) {
color: rgb(209 213 219); /*text-gray-300*/
}
.dark .prose :where(h1,h2,h3,h4,h5,h6,th):not(:where([class~="not-prose"] *)) {
Expand Down
2 changes: 1 addition & 1 deletion MyApp/wwwroot/lib/mjs/servicestack-vue.min.mjs

Large diffs are not rendered by default.

17 changes: 8 additions & 9 deletions MyApp/wwwroot/lib/mjs/servicestack-vue.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6882,27 +6882,26 @@ const L0 = { key: 0 }, V0 = { class: "text-red-700" }, S0 = /* @__PURE__ */ s("b
], Qm = /* @__PURE__ */ ce({
__name: "DarkModeToggle",
setup(e) {
const t = typeof document < "u" ? document.querySelector("html") : null;
let l = A(t == null ? void 0 : t.classList.contains("dark"));
function n() {
l.value ? t == null || t.classList.remove("dark") : t == null || t.classList.add("dark"), l.value = !l.value, localStorage.setItem("color-scheme", l.value ? "dark" : "light");
const t = typeof document < "u" ? document.documentElement : null, l = () => !!(t != null && t.classList.contains("dark")), n = A(localStorage.getItem("color-scheme") == "dark");
function i() {
l() ? t == null || t.classList.remove("dark") : t == null || t.classList.add("dark"), n.value = l(), localStorage.setItem("color-scheme", n.value ? "dark" : "light");
}
return (i, r) => (a(), u("button", {
return (r, d) => (a(), u("button", {
type: "button",
class: "bg-gray-200 dark:bg-gray-700 relative inline-flex flex-shrink-0 h-6 w-11 border-2 border-transparent rounded-full cursor-pointer transition-colors ease-in-out duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 dark:ring-offset-black",
role: "switch",
"aria-checked": "false",
onClick: r[0] || (r[0] = (d) => n())
onClick: d[0] || (d[0] = (c) => i())
}, [
s("span", {
class: w(`${o(l) ? "translate-x-0" : "translate-x-5"} pointer-events-none relative inline-block h-5 w-5 rounded-full bg-white dark:bg-black shadow transform ring-0 transition ease-in-out duration-200`)
class: w(`${n.value ? "translate-x-0" : "translate-x-5"} pointer-events-none relative inline-block h-5 w-5 rounded-full bg-white dark:bg-black shadow transform ring-0 transition ease-in-out duration-200`)
}, [
s("span", {
class: w(`${o(l) ? "opacity-100 ease-in duration-200" : "opacity-0 ease-out duration-100"} absolute inset-0 h-full w-full flex items-center justify-center transition-opacity`),
class: w(`${n.value ? "opacity-100 ease-in duration-200" : "opacity-0 ease-out duration-100"} absolute inset-0 h-full w-full flex items-center justify-center transition-opacity`),
"aria-hidden": "true"
}, Nm, 2),
s("span", {
class: w(`${o(l) ? "opacity-0 ease-out duration-100" : "opacity-100 ease-in duration-200"} absolute inset-0 h-full w-full flex items-center justify-center transition-opacity`),
class: w(`${n.value ? "opacity-0 ease-out duration-100" : "opacity-100 ease-in duration-200"} absolute inset-0 h-full w-full flex items-center justify-center transition-opacity`),
"aria-hidden": "true"
}, qm, 2)
], 2)
Expand Down
4 changes: 4 additions & 0 deletions MyApp/wwwroot/mjs/app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export function mount(sel, component, props) {
if (client && !app._context.provides.client) {
app.provide('client', client)
}
app.config.errorHandler = error => { console.log(error) }
app.config.compilerOptions.isCustomElement = tag => CustomElements.includes(tag)
app.mount(el)
Apps.push(app)
Expand Down Expand Up @@ -199,4 +200,7 @@ document.addEventListener('DOMContentLoaded', () =>
Blazor.addEventListener('enhancedload', () => {
remount()
globalThis.hljs?.highlightAll()
if (localStorage.getItem('color-scheme') == 'dark') {
document.documentElement.classList.add('dark')
}
}))

0 comments on commit f93064a

Please sign in to comment.