-
Notifications
You must be signed in to change notification settings - Fork 4
Issue 4.1 connect freighter wallet #21
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
Changes from all commits
1e5455c
2fcbf10
14c9005
c363ba4
4ddd454
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import React from 'react'; | ||
|
|
||
| export interface ConnectWalletButtonProps { | ||
| onClick: () => void; | ||
| publicKey?: string; | ||
| } | ||
|
|
||
| function truncatePublicKey(key: string) { | ||
| if (!key) return ''; | ||
| return key.slice(0, 4) + '...' + key.slice(-4); | ||
| } | ||
|
|
||
| export const ConnectWalletButton: React.FC<ConnectWalletButtonProps> = ({ onClick, publicKey }) => { | ||
| return ( | ||
| <button onClick={onClick} className="connect-wallet-btn"> | ||
| {publicKey ? truncatePublicKey(publicKey) : 'Connect Wallet'} | ||
| </button> | ||
|
Comment on lines
+3
to
+17
|
||
| ); | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import React from 'react'; | ||
|
|
||
| export const DashboardHeader: React.FC<{ children?: React.ReactNode }> = ({ children }) => ( | ||
| <header className="dashboard-header" style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '1rem 2rem', borderBottom: '1px solid #eee' }}> | ||
| <div style={{ fontWeight: 700, fontSize: '1.5rem' }}>Smasage</div> | ||
| <div>{children}</div> | ||
| </header> | ||
| ); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| "use client"; | ||
| import { createContext, useContext, useState, ReactNode } from 'react'; | ||
|
|
||
| interface WalletContextType { | ||
| publicKey: string | null; | ||
| setPublicKey: (key: string | null) => void; | ||
| } | ||
|
|
||
| const WalletContext = createContext<WalletContextType | undefined>(undefined); | ||
|
|
||
| export const WalletProvider = ({ children }: { children: ReactNode }) => { | ||
| const [publicKey, setPublicKey] = useState<string | null>(null); | ||
| return ( | ||
| <WalletContext.Provider value={{ publicKey, setPublicKey }}> | ||
| {children} | ||
| </WalletContext.Provider> | ||
| ); | ||
| }; | ||
|
|
||
| export const useWallet = () => { | ||
| const ctx = useContext(WalletContext); | ||
| if (!ctx) throw new Error('useWallet must be used within WalletProvider'); | ||
| return ctx; | ||
| }; |
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.
This snapshot contains unresolved git merge-conflict markers (
=======/>>>>>>> ...), which makes the JSON invalid and will break snapshot-based tests/tools. Please resolve the conflict and regenerate the snapshot so it’s valid JSON.