Skip to content

Commit

Permalink
bolt panorama initial
Browse files Browse the repository at this point in the history
  • Loading branch information
halr9000 committed Oct 31, 2024
1 parent 6738cd2 commit bc9a72f
Show file tree
Hide file tree
Showing 8 changed files with 5,300 additions and 0 deletions.
13 changes: 13 additions & 0 deletions bolt-panorama/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Photo Gallery</title>
<link rel="manifest" href="/manifest.json">
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
5,157 changes: 5,157 additions & 0 deletions bolt-panorama/package-lock.json

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions bolt-panorama/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "pwa-photo-gallery",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"photo-sphere-viewer": "^4.0.0"
},
"devDependencies": {
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"@vitejs/plugin-react": "^3.1.0",
"vite": "^4.2.0",
"vite-plugin-pwa": "^0.14.0"
}
}
20 changes: 20 additions & 0 deletions bolt-panorama/public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "Photo Gallery",
"short_name": "Gallery",
"start_url": ".",
"display": "standalone",
"background_color": "#ffffff",
"description": "A mobile-optimized photo gallery PWA",
"icons": [
{
"src": "icon-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "icon-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
]
}
13 changes: 13 additions & 0 deletions bolt-panorama/src/App.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';
import Gallery from './components/Gallery';

function App() {
return (
<div className="App">
<h1>Photo Gallery</h1>
<Gallery />
</div>
);
}

export default App;
45 changes: 45 additions & 0 deletions bolt-panorama/src/components/Gallery.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import React, { useState } from 'react';
import PhotoSphereViewer from 'photo-sphere-viewer';

const images = [
'/images/photo1.jpg',
'/images/photo2.jpg',
// Add more image paths here
];

function Gallery() {
const [viewer, setViewer] = useState(null);

const openViewer = (image) => {
if (viewer) {
viewer.setPanorama(image);
} else {
const newViewer = new PhotoSphereViewer.Viewer({
container: document.querySelector('#viewer'),
panorama: image,
navbar: true,
defaultZoomLvl: 50,
});
setViewer(newViewer);
}
};

return (
<div>
<div className="gallery">
{images.map((image, index) => (
<img
key={index}
src={image}
alt={`Photo ${index + 1}`}
onClick={() => openViewer(image)}
className="thumbnail"
/>
))}
</div>
<div id="viewer" className="viewer"></div>
</div>
);
}

export default Gallery;
23 changes: 23 additions & 0 deletions bolt-panorama/src/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
body {
margin: 0;
font-family: Arial, sans-serif;
}

.gallery {
display: flex;
flex-wrap: wrap;
justify-content: center;
}

.thumbnail {
width: 100px;
height: 100px;
margin: 5px;
cursor: pointer;
}

.viewer {
width: 100%;
height: 400px;
margin-top: 20px;
}
6 changes: 6 additions & 0 deletions bolt-panorama/src/main.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import './index.css';

ReactDOM.render(<App />, document.getElementById('root'));

0 comments on commit bc9a72f

Please sign in to comment.