-
Notifications
You must be signed in to change notification settings - Fork 14
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
Test #69
Closed
Closed
Test #69
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 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 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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,34 @@ | ||
{ | ||
"name": "Champion Trader", | ||
"short_name": "ChampionTrader", | ||
"description": "A React-based trading application for options trading", | ||
"start_url": "/", | ||
"display": "standalone", | ||
"background_color": "#ffffff", | ||
"theme_color": "#0033ff", | ||
"icons": [ | ||
{ | ||
"src": "/logo192.png", | ||
"sizes": "192x192", | ||
"type": "image/png", | ||
"purpose": "any maskable" | ||
}, | ||
{ | ||
"src": "/logo512.png", | ||
"sizes": "512x512", | ||
"type": "image/png", | ||
"purpose": "any maskable" | ||
} | ||
], | ||
"orientation": "portrait", | ||
"categories": ["finance", "trading"], | ||
"shortcuts": [ | ||
{ | ||
"name": "Open Trading Page", | ||
"short_name": "Trade", | ||
"description": "Go to trading page", | ||
"url": "/trade", | ||
"icons": [{ "src": "/icons/trade.png", "sizes": "96x96" }] | ||
} | ||
] | ||
} |
This file contains 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,161 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Champion Trader - Offline</title> | ||
<link rel="manifest" href="/manifest.json"> | ||
<meta name="theme-color" content="#0033ff"> | ||
<style> | ||
body { | ||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; | ||
margin: 0; | ||
padding: 0; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100vh; | ||
background-color: #f5f5f5; | ||
color: #333; | ||
} | ||
|
||
.container { | ||
text-align: center; | ||
padding: 2rem; | ||
border-radius: 8px; | ||
background-color: white; | ||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); | ||
max-width: 90%; | ||
width: 400px; | ||
} | ||
|
||
h1 { | ||
margin-top: 0; | ||
color: #0033ff; | ||
} | ||
|
||
.icon { | ||
font-size: 64px; | ||
margin-bottom: 1rem; | ||
} | ||
|
||
.btn { | ||
display: inline-block; | ||
background-color: #0033ff; | ||
color: white; | ||
padding: 10px 20px; | ||
border-radius: 4px; | ||
text-decoration: none; | ||
font-weight: 500; | ||
margin-top: 1rem; | ||
border: none; | ||
cursor: pointer; | ||
} | ||
|
||
.pending-trades { | ||
margin-top: 2rem; | ||
text-align: left; | ||
border-top: 1px solid #eee; | ||
padding-top: 1rem; | ||
} | ||
|
||
.trade-item { | ||
padding: 0.5rem; | ||
border-bottom: 1px solid #eee; | ||
} | ||
|
||
@media (prefers-color-scheme: dark) { | ||
body { | ||
background-color: #121212; | ||
color: #eee; | ||
} | ||
|
||
.container { | ||
background-color: #1e1e1e; | ||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3); | ||
} | ||
|
||
h1 { | ||
color: #4d8cff; | ||
} | ||
|
||
.btn { | ||
background-color: #4d8cff; | ||
} | ||
|
||
.pending-trades { | ||
border-top: 1px solid #333; | ||
} | ||
|
||
.trade-item { | ||
border-bottom: 1px solid #333; | ||
} | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<div class="icon">📡</div> | ||
<h1>You're offline</h1> | ||
<p>Champion Trader can't connect to the internet right now. Some features may be unavailable until you're back online.</p> | ||
|
||
<button class="btn" id="refresh-btn">Try Again</button> | ||
|
||
<div class="pending-trades" id="pending-trades" style="display: none;"> | ||
<h2>Pending Trades</h2> | ||
<div id="pending-trades-list"></div> | ||
</div> | ||
</div> | ||
|
||
<script> | ||
// Check if the browser is online | ||
function updateOnlineStatus() { | ||
if (navigator.onLine) { | ||
document.querySelector('.container p').textContent = 'Connected! Refreshing...'; | ||
// Reload the page | ||
window.location.reload(); | ||
} | ||
} | ||
|
||
// Try again button | ||
document.getElementById('refresh-btn').addEventListener('click', () => { | ||
document.querySelector('.container p').textContent = 'Checking connection...'; | ||
updateOnlineStatus(); | ||
}); | ||
|
||
// Listen for online event | ||
window.addEventListener('online', updateOnlineStatus); | ||
|
||
// Try to load the pending trades from IndexedDB | ||
if ('indexedDB' in window) { | ||
const request = indexedDB.open('ChampionTraderDB', 1); | ||
|
||
request.onsuccess = (event) => { | ||
const db = event.target.result; | ||
|
||
if (db.objectStoreNames.contains('pendingTrades')) { | ||
const transaction = db.transaction('pendingTrades', 'readonly'); | ||
const store = transaction.objectStore('pendingTrades'); | ||
const getAll = store.getAll(); | ||
|
||
getAll.onsuccess = () => { | ||
const pendingTrades = getAll.result; | ||
|
||
if (pendingTrades && pendingTrades.length > 0) { | ||
document.getElementById('pending-trades').style.display = 'block'; | ||
const list = document.getElementById('pending-trades-list'); | ||
|
||
pendingTrades.forEach(trade => { | ||
const item = document.createElement('div'); | ||
item.className = 'trade-item'; | ||
item.textContent = `${trade.type} trade - ${trade.instrument} (${new Date(trade.timestamp).toLocaleString()})`; | ||
list.appendChild(item); | ||
}); | ||
} | ||
}; | ||
} | ||
}; | ||
} | ||
</script> | ||
</body> | ||
</html> |
Oops, something went wrong.
Oops, something went wrong.
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.
suggestion: Provide details about push notification implementation and usage
The documentation mentions push notification support, but lacks details about how it's implemented and used within the app. Adding this information would be beneficial.