-
Notifications
You must be signed in to change notification settings - Fork 6
Added get started button to home page #548
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dafuga
wants to merge
7
commits into
dev
Choose a base branch
from
adding-getting-started-button
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
dec0f8b
chore: added get started button to home page
dafuga 96c30ff
enhancement: assuming that plugin is available
dafuga f204691
refactor: using effect instead of polling
dafuga b31e3c3
refactor: using derived.by
dafuga fa04965
fix: making hero section mobile friendly
dafuga 7f142ee
fix: making some text adjustements
dafuga b2f31b1
fix: making the button full width only on mobile
dafuga File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,4 +22,6 @@ Thumbs.db | |
| # Vite | ||
| vite.config.js.timestamp-* | ||
| vite.config.ts.timestamp-* | ||
| .wrangler | ||
| .wrangler | ||
|
|
||
| project.inlang/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/routes/[[locale]]/[network]/(homepage)/components/get-started.svelte
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| <script lang="ts"> | ||
| import { getContext } from 'svelte'; | ||
| import { goto } from '$app/navigation'; | ||
| import type { UnicoveContext } from '$lib/state/client.svelte'; | ||
| import type { LoginOptions } from '@wharfkit/session'; | ||
| import { Button } from 'unicove-components'; | ||
|
|
||
| const context = getContext<UnicoveContext>('state'); | ||
| const urlPath = $derived(context.urlPath); | ||
|
|
||
| const TARGET_PLUGIN_ID = 'web-authenticator'; | ||
|
|
||
| const pluginAvailable = $derived.by(() => { | ||
| const sessionKit = context.wharf.sessionKit; | ||
| if (sessionKit) { | ||
| return sessionKit.walletPlugins.some((wallet) => wallet.id === TARGET_PLUGIN_ID); | ||
| } | ||
| return true; | ||
| }); | ||
|
|
||
| async function handleGetStarted() { | ||
| if (!context.wharf.sessionKit) { | ||
| return; | ||
| } | ||
|
|
||
| const webAuthenticatorPlugin = context.wharf.sessionKit.walletPlugins.find( | ||
| (wallet) => wallet.id === TARGET_PLUGIN_ID | ||
| ); | ||
|
|
||
| if (!webAuthenticatorPlugin) { | ||
| console.error('Web Authenticator plugin not found'); | ||
| return; | ||
| } | ||
|
|
||
| const options: LoginOptions = { | ||
| walletPlugin: webAuthenticatorPlugin.id, | ||
| chain: context.network.chain.id | ||
| }; | ||
|
|
||
| try { | ||
| const session = await context.wharf.login(options); | ||
| goto(urlPath(`/account/${session.actor}`)); | ||
| } catch (error) { | ||
| console.error('Failed to login with web authenticator:', error); | ||
| } | ||
| } | ||
| </script> | ||
|
|
||
| {#if pluginAvailable} | ||
| <Button variant="primary" class="w-full justify-center md:w-auto" onclick={handleGetStarted} | ||
| >Get started with an account</Button | ||
| > | ||
| {/if} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming that it's fine to remove this button at this point.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I think so