-
Notifications
You must be signed in to change notification settings - Fork 1
Support PWA #277
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
shaysqm
wants to merge
5
commits into
main
Choose a base branch
from
pwa
base: main
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
Support PWA #277
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a69a5d3
Support PWA
shaysqm 5f2cb11
Merge branch 'main' into pwa
shaysqm e3ba038
Merge commit '466000e7abf9c99d59e284ec2e59417331f85532' into pwa
jonatan-qm d74d5d4
Fixing minor problems related to lint.
jonatan-qm e1e1f40
Bugfixes - now the PWA is working.
jonatan-qm 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 |
|---|---|---|
|
|
@@ -163,3 +163,5 @@ cython_debug/ | |
|
|
||
| # Mac OS Files | ||
| .DS_Store | ||
|
|
||
| .nul | ||
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
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.
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.
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 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,57 @@ | ||
| { | ||
| "version": "0.4.0", | ||
| "manifest_version": 2, | ||
| "short_name": "QUAlibrate", | ||
| "name": "QUAlibrate", | ||
| "short_name": "QUAlibrate", | ||
| "description": "Web Interface for QUAlibrate - Advanced Quantum System Calibration", | ||
| "version": "0.4.0", | ||
| "start_url": "/", | ||
| "display": "standalone", | ||
| "orientation": "any", | ||
| "theme_color": "#2b2c32", | ||
| "background_color": "#ffffff", | ||
| "scope": "/", | ||
| "icons": [ | ||
| { | ||
| "src": "favicon.png", | ||
| "sizes": "64x64 32x32 24x24 16x16", | ||
| "type": "image/x-icon" | ||
| "src": "/assets/icons/icon-72x72.png", | ||
| "sizes": "72x72", | ||
| "type": "image/png" | ||
| }, | ||
| { | ||
| "src": "/assets/icons/icon-96x96.png", | ||
| "sizes": "96x96", | ||
| "type": "image/png" | ||
| }, | ||
| { | ||
| "src": "/assets/icons/icon-128x128.png", | ||
| "sizes": "128x128", | ||
| "type": "image/png" | ||
| }, | ||
| { | ||
| "src": "/assets/icons/icon-144x144.png", | ||
| "sizes": "144x144", | ||
| "type": "image/png" | ||
| }, | ||
| { | ||
| "src": "/assets/icons/icon-152x152.png", | ||
| "sizes": "152x152", | ||
| "type": "image/png" | ||
| }, | ||
| { | ||
| "src": "/assets/icons/icon-192x192.png", | ||
| "sizes": "192x192", | ||
| "type": "image/png" | ||
| }, | ||
| { | ||
| "src": "/assets/icons/icon-384x384.png", | ||
| "sizes": "384x384", | ||
| "type": "image/png" | ||
| }, | ||
| { | ||
| "src": "/assets/icons/icon-512x512.png", | ||
| "sizes": "512x512", | ||
| "type": "image/png" | ||
| } | ||
| ], | ||
| "start_url": ".", | ||
| "display": "standalone", | ||
| "theme_color": "#000000", | ||
| "background_color": "#ffffff" | ||
| "categories": ["productivity", "utilities", "science"], | ||
| "lang": "en", | ||
| "dir": "ltr" | ||
| } |
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,31 @@ | ||
| // Basic Service Worker for QUAlibrate PWA | ||
| // Provides installability without offline functionality | ||
|
|
||
| const CACHE_NAME = 'qualibrate-basic-v4'; | ||
|
|
||
| // Minimal service worker for PWA installability | ||
| self.addEventListener('install', (event) => { | ||
| console.log('[SW] Service worker installing for PWA installability'); | ||
| // Skip waiting to activate immediately | ||
| self.skipWaiting(); | ||
| }); | ||
|
|
||
| self.addEventListener('activate', (event) => { | ||
| console.log('[SW] Service worker activated'); | ||
| // Claim all clients immediately | ||
| event.waitUntil(self.clients.claim()); | ||
| }); | ||
|
|
||
| // Minimal fetch handler - just passes through all requests | ||
| self.addEventListener('fetch', (event) => { | ||
| // Let all requests go through to the network normally | ||
| // This ensures your app works exactly as before, just with PWA install capability | ||
| return; | ||
| }); | ||
|
|
||
| // Handle messages from the main thread | ||
| self.addEventListener('message', (event) => { | ||
| if (event.data && event.data.type === 'SKIP_WAITING') { | ||
| self.skipWaiting(); | ||
| } | ||
| }); |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| const fs = require('fs'); | ||
| const path = require('path'); | ||
| const { spawn } = require('child_process'); | ||
|
|
||
| // This script converts SVG icon to PNG format for PWA compatibility | ||
| // Usage: node convert-icons.js <path-to-svg-file> | ||
| const sizes = [72, 96, 128, 144, 152, 192, 384, 512]; | ||
| const iconsDir = path.join(__dirname, '..', 'public', 'assets', 'icons'); | ||
| const inputSvg = process.argv[2] || path.join(__dirname, '..', '..', '..', 'tmp', 'QM_white.svg'); | ||
|
|
||
| // Ensure icons directory exists | ||
| if (!fs.existsSync(iconsDir)) { | ||
| fs.mkdirSync(iconsDir, { recursive: true }); | ||
| } | ||
|
|
||
| async function convertSvgToPng(size) { | ||
| return new Promise((resolve, reject) => { | ||
| const pngPath = path.join(iconsDir, `icon-${size}x${size}.png`); | ||
|
|
||
| // Use ImageMagick convert to create PNG with specific size | ||
| const convert = spawn('magick', ['convert', inputSvg, '-resize', `${size}x${size}`, '-background', 'none', pngPath]); | ||
|
|
||
| convert.on('error', (err) => { | ||
| reject(new Error(`ImageMagick not found. Please install ImageMagick or use create-png-icons.html`)); | ||
| }); | ||
|
|
||
| convert.on('close', (code) => { | ||
| if (code === 0) { | ||
| console.log(`Created PNG icon: icon-${size}x${size}.png`); | ||
| resolve(); | ||
| } | ||
| }); | ||
| }); | ||
| } | ||
|
|
||
| (async () => { | ||
| if (!fs.existsSync(inputSvg)) { | ||
| console.error(`Error: SVG file not found at ${inputSvg}`); | ||
| console.log('Usage: node convert-icons.js <path-to-svg-file>'); | ||
| process.exit(1); | ||
| } | ||
|
|
||
| console.log(`Converting ${inputSvg} to PNG icons...`); | ||
|
|
||
| try { | ||
| for (const size of sizes) { | ||
| await convertSvgToPng(size); | ||
| } | ||
| console.log('\\nAll PNG icons created successfully!'); | ||
| console.log('Icons saved to:', iconsDir); | ||
| } catch (error) { | ||
| console.error('Error creating icons:', error.message); | ||
| console.log('\\nAlternative: Open frontend/tools/create-png-icons.html in your browser'); | ||
| } | ||
| })(); |
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,76 @@ | ||
| <!DOCTYPE html> | ||
| <html> | ||
| <head> | ||
| <title>Generate PNG Icons</title> | ||
| <style> | ||
| body { font-family: Arial, sans-serif; padding: 20px; max-width: 600px; margin: 0 auto; } | ||
| input[type="file"] { margin: 20px 0; padding: 10px; border: 2px solid #2CCBE5; } | ||
| button { padding: 10px 20px; background: #2CCBE5; color: white; border: none; cursor: pointer; } | ||
| button:disabled { background: #ccc; cursor: not-allowed; } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <h1>Convert SVG to PNG Icons</h1> | ||
| <p>Select an SVG file to convert to multiple PNG sizes for PWA icons</p> | ||
| <input type="file" id="svgFile" accept=".svg"> | ||
| <div id="status"></div> | ||
| <script> | ||
| const sizes = [72, 96, 128, 144, 152, 192, 384, 512]; | ||
| const status = document.getElementById('status'); | ||
| const fileInput = document.getElementById('svgFile'); | ||
|
|
||
| fileInput.addEventListener('change', async (e) => { | ||
| const file = e.target.files[0]; | ||
| if (!file) return; | ||
|
|
||
| const svgText = await file.text(); | ||
| status.innerHTML = '<p>Starting conversion...</p>'; | ||
|
|
||
| for (const size of sizes) { | ||
| await createPngIcon(svgText, size); | ||
| await new Promise(resolve => setTimeout(resolve, 500)); | ||
| } | ||
| status.innerHTML += '<p><strong>✓ Done! Move all downloaded PNG files to frontend/public/assets/icons/</strong></p>'; | ||
| }); | ||
|
|
||
| async function createPngIcon(svgText, size) { | ||
| // Parse and modify SVG dimensions | ||
| const parser = new DOMParser(); | ||
| const svgDoc = parser.parseFromString(svgText, 'image/svg+xml'); | ||
| const svgElement = svgDoc.documentElement; | ||
|
|
||
| svgElement.setAttribute('width', size); | ||
| svgElement.setAttribute('height', size); | ||
|
|
||
| const svg = new XMLSerializer().serializeToString(svgElement); | ||
|
|
||
| // Create canvas | ||
| const canvas = document.createElement('canvas'); | ||
| canvas.width = size; | ||
| canvas.height = size; | ||
| const ctx = canvas.getContext('2d'); | ||
|
|
||
| // Create image from SVG | ||
| const img = new Image(); | ||
| const svgBlob = new Blob([svg], { type: 'image/svg+xml;charset=utf-8' }); | ||
| const url = URL.createObjectURL(svgBlob); | ||
|
|
||
| return new Promise((resolve) => { | ||
| img.onload = () => { | ||
| ctx.drawImage(img, 0, 0, size, size); | ||
| canvas.toBlob((blob) => { | ||
| const link = document.createElement('a'); | ||
| link.download = `icon-${size}x${size}.png`; | ||
| link.href = URL.createObjectURL(blob); | ||
| link.click(); | ||
| status.innerHTML += `<p>✓ Created icon-${size}x${size}.png</p>`; | ||
| URL.revokeObjectURL(url); | ||
| resolve(); | ||
| }, 'image/png'); | ||
| }; | ||
| img.src = url; | ||
| }); | ||
| } | ||
| </script> | ||
| </body> | ||
| </html> |
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
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.
This is a tiny buxfix to ensure that npm run lint:fix is working properly.