Skip to content

Commit

Permalink
onboarding and settings fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Levminer committed Jan 11, 2025
1 parent e9f34a1 commit 85284da
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 49 deletions.
56 changes: 56 additions & 0 deletions platforms/interface/ui/components/feedbackDialog.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<ModularDialog title={"Feedback"} description={"Feedback is always welcome! Report issues or request features."}>
<slot slot="openButton">
<Dialog.Trigger class="button">
<Megaphone />
Feedback
</Dialog.Trigger>
</slot>
<div class="w-full">
<Tabs.Root value="file" class="">
<Tabs.List class="grid w-full grid-cols-2 gap-1 rounded-xl border-2 p-1 text-sm font-semibold leading-[0.01em]">
<Tabs.Trigger
value="file"
class="h-10 rounded-xl bg-transparent py-2 text-base data-[state=active]:bg-white data-[state=active]:text-black"
>
GitHub
</Tabs.Trigger>
<Tabs.Trigger
value="image"
class="h-10 rounded-xl bg-transparent py-2 text-base data-[state=active]:bg-white data-[state=active]:text-black"
>
Email
</Tabs.Trigger>
</Tabs.List>
<Tabs.Content value="file" class="pt-10">
<div>
<h5 class="mb-3">Report Issues or Request Features</h5>
<button
on:click={() => {
open("https://github.com/levminer/cores/issues")
}}
class="button w-full">Open GitHub</button
>
</div>
</Tabs.Content>
<Tabs.Content value="image" class="pt-10">
<div>
<h5 class="mb-3">Send an email to [email protected]</h5>
<button
on:click={() => {
open("mailto:[email protected]")
}}
class="button w-full">Send Email</button
>
</div>
</Tabs.Content>
</Tabs.Root>
</div>
</ModularDialog>

<script lang="ts">
import { Dialog, Tabs } from "bits-ui"
import ModularDialog from "./modularDialog.svelte"
import { settings } from "../stores/settings.ts"
import { Megaphone, Github } from "lucide-svelte"
import { open } from "@tauri-apps/plugin-shell"
</script>
10 changes: 3 additions & 7 deletions platforms/interface/ui/pages/home.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,10 @@
<div id="status" class="relative top-0.5 size-3 rounded-full bg-red-500" />
{/if}
</a>
<button
on:click={() => {
open("https://cores.canny.io/feature-requests")
}}
class="transparent-900 flex aspect-square items-center justify-center rounded-lg p-3 sm:p-2"
>

<a href="/settings" class="transparent-900 flex aspect-square items-center justify-center rounded-lg p-3 sm:p-2">
<Megaphone />
</button>
</a>

<a href="/settings" class="transparent-900 flex aspect-square items-center justify-center rounded-lg p-3 sm:p-2">
<Settings />
Expand Down
27 changes: 9 additions & 18 deletions platforms/interface/ui/pages/onboarding.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -258,21 +258,6 @@
}
})
/*
onMount(() => {
// Check if trial is over
if ($settings.licenseActivated) {
let dateActivated = new Date($settings.licenseActivated)
let dateNow = new Date()
let diff = dateNow.getTime() - dateActivated.getTime()
let days = Math.ceil(diff / (1000 * 3600 * 24))
if (days > 7) {
stepPricing()
}
}
}) */
const stepLogin = () => {
step = "login"
}
Expand All @@ -299,6 +284,7 @@
// Start server
const port = await start({
response: `<div style="display:flex;flex-direction:column;align-items:center;justify-content:center;height:100vh;font-family:Arial,sans-serif;background:#1a1a1a;margin:0;position:fixed;top:0;left:0;right:0;bottom:0"><h2 style="color:white;margin:0">Authentication Completed</h2><p style="color:#999">You can now close this page and return to the app.</p></div><style>body{margin:0;padding:0;background:#1a1a1a}</style>`,
ports: [5380, 5385],
})
// Listen for OAuth result
Expand All @@ -316,14 +302,15 @@
if (error || userError) {
alert(
`Failed to login, please try again or send an email to [email protected] if you need help.\nError: ${
`Failed to login, please restart the app and try again or send an email to [email protected] if you need help.\nError: ${
error || userError
}`,
)
}
if (userData.plan === "personal" || userData.plan === "business") {
// User is on a paid plan
$state.plan = userData.plan
$state.showMenu = true
router.goto("/home")
}
Expand All @@ -342,15 +329,19 @@
})
if (error) {
alert(`Failed to login, please try again or send an email to [email protected] if you need help.\nError: ${error}`)
alert(
`Failed to login, please restart the app and try again or send an email to [email protected] if you need help.\nError: ${error}`,
)
}
if (data) {
console.log(data)
open(data.url)
}
} catch (error) {
alert(`Failed to login, please try again or send an email to [email protected] if you need help.\nError: ${error}`)
alert(
`Failed to login, please restart the app and try again or send an email to [email protected] if you need help.\nError: ${error}`,
)
}
}
Expand Down
76 changes: 55 additions & 21 deletions platforms/interface/ui/pages/settings.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -41,52 +41,70 @@
/>
</div>
</div>

<!-- account -->
<div class="transparent-800 flex w-full flex-row flex-wrap items-center justify-between rounded-xl p-8 text-left sm:p-4">
<div class="flex flex-col items-start gap-3">
<div class="flex items-center gap-3">
<div class="transparent-900 flex aspect-square items-center justify-center rounded-lg p-3 sm:p-2">
<User />
</div>
<h2>Account</h2>
</div>
<h3>{user?.email ?? "Loading..."}</h3>
</div>

<div class="flex flex-col items-start gap-3 sm:my-5">
<button
on:click={async () => {
await supabaseClient.auth.signOut()
location.href = "/onboarding"
}}
class="button"
>
<LogOut />
Log out
</button>
</div>
</div>
</div>
</div>

<div class="transparent-900 m-10 mx-auto w-11/12 rounded-xl sm:w-full">
<div class="mx-10 flex flex-col gap-5 pb-10 pt-10 sm:mx-3 sm:flex-wrap">
<!-- debug report -->
<!-- feedback -->
<div class="transparent-800 flex w-full flex-row items-center justify-between rounded-xl p-8 text-left sm:p-4">
<div class="flex flex-col items-start gap-3">
<div class="flex items-center gap-3">
<div class="transparent-900 flex aspect-square items-center justify-center rounded-lg p-3 sm:p-2">
<Bug />
<Megaphone />
</div>
<h2>Debug report</h2>
<h2>Feedback</h2>
</div>
<h3>Debug information about your computer. Include this report with your feedback.</h3>
<h3>Feedback is always welcome! Report issues or request features.</h3>
</div>

<div class="flex flex-col items-start gap-3">
<button class="button" on:click={debug}>
<FileCog />
Save
</button>
<FeedbackDialog />
</div>
</div>

<!-- feedback -->
<!-- debug report -->
<div class="transparent-800 flex w-full flex-row items-center justify-between rounded-xl p-8 text-left sm:p-4">
<div class="flex flex-col items-start gap-3">
<div class="flex items-center gap-3">
<div class="transparent-900 flex aspect-square items-center justify-center rounded-lg p-3 sm:p-2">
<Megaphone />
<Bug />
</div>
<h2>Feedback</h2>
<h2>Debug report</h2>
</div>
<h3>Thank you for providing feedback! Please report issues or feature requests on GitHub or by Email (feedback@coresmonitor.com).</h3>
<h3>Debug information about your computer. Include this report with your feedback.</h3>
</div>

<div class="flex flex-col items-start gap-3">
<button
class="button"
on:click={() => {
open("https://github.com/levminer/cores/issues")
}}
>
<Github />
GitHub
<button class="button" on:click={debug}>
<FileCog />
Save
</button>
</div>
</div>
Expand Down Expand Up @@ -119,10 +137,26 @@
import build from "../../../../build.json"
import Select from "ui/components/select.svelte"
import Toggle from "ui/components/toggle.svelte"
import { Minimize2, RefreshCcw, Bug, Megaphone, Info, Cable, Github, FileCog } from "lucide-svelte"
import { Minimize2, RefreshCcw, Bug, Megaphone, Info, Cable, Github, FileCog, User, LogOut } from "lucide-svelte"
import { open } from "@tauri-apps/plugin-shell"
import { message, save } from "@tauri-apps/plugin-dialog"
import { invoke } from "@tauri-apps/api/core"
import FeedbackDialog from "ui/components/feedbackDialog.svelte"
import { supabaseClient } from "../utils/supabase.ts"
import { onMount } from "svelte"
$: user = null
onMount(async () => {
const { data, error } = await supabaseClient.auth.getUser()
if (!error && data.user) {
user = data.user
}
})
const launchOnStartup = () => {
// @ts-ignore
Expand Down
6 changes: 3 additions & 3 deletions platforms/interface/web/src/components/appHeader.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
<span class="self-center whitespace-nowrap text-xl font-semibold text-white">Cores</span>
</a>
<div class="flex space-x-2 md:order-2">
{#if $state.state === "connected"}
<PowerDropdown {action} />
{/if}
<a
href="/account"
class="inline-flex items-center justify-center gap-2 rounded-2xl bg-gray-700 px-3 py-2 text-lg font-medium duration-200 ease-in hover:bg-white hover:text-black"
>
<User />
<p class="hidden md:block">Account</p>
</a>
{#if $state.state === "connected"}
<PowerDropdown {action} />
{/if}
<ConnectionDropdown {connect} />
</div>
</div>
Expand Down

0 comments on commit 85284da

Please sign in to comment.