Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions src/apps/tracy/pages/TracyPage.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,24 @@
.canvasWrapper {
position: relative;
width: 100%;
aspect-ratio: 800/640;
background: #0a0a0f;
border-radius: 8px;
overflow: visible;
overflow: hidden;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 300px;
}

.canvas {
max-width: 100%;
max-height: 70vh;
width: 100%;
height: 100%;
object-fit: contain;
user-select: none;
-webkit-user-select: none;
-webkit-touch-callout: default;
touch-action: manipulation;
border-radius: 4px;
}

.loadingOverlay {
Expand Down Expand Up @@ -141,16 +140,13 @@
.result {
width: 100%;
text-align: center;
display: flex;
flex-direction: column;
align-items: center;
gap: 1rem;
}

.resultActions {
display: flex;
gap: 0.5rem;
justify-content: center;
margin-top: 1rem;
flex-wrap: wrap;
}

Expand Down
80 changes: 40 additions & 40 deletions src/apps/tracy/pages/TracyPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,48 +206,25 @@ const TracyPage = () => {
)}

{imageData && !isLoading && (
<div className={styles.result}>
<canvas
id="render-canvas"
className={styles.canvas}
width={imageData.width}
height={imageData.height}
ref={(canvas) => {
if (canvas && imageData) {
const ctx = canvas.getContext('2d')
if (ctx) {
const img = new Image()
img.onload = () => {
ctx.clearRect(0, 0, canvas.width, canvas.height)
ctx.drawImage(img, 0, 0)
}
img.src = `data:image/png;base64,${imageData.base64_png}`
<canvas
id="render-canvas"
className={styles.canvas}
width={imageData.width}
height={imageData.height}
ref={(canvas) => {
if (canvas && imageData) {
const ctx = canvas.getContext('2d')
if (ctx) {
const img = new Image()
img.onload = () => {
ctx.clearRect(0, 0, canvas.width, canvas.height)
ctx.drawImage(img, 0, 0)
}
img.src = `data:image/png;base64,${imageData.base64_png}`
}
}}
/>

<div className={styles.resultActions}>
<button onClick={downloadImage} className={styles.downloadButton}>
📥 Download
</button>
<button
id="copy-button"
onClick={copyToClipboard}
className={styles.copyButton}
>
📋 Copy to Clipboard
</button>
<button
id="blur-button"
onClick={blurImage}
disabled={isLoading}
className={styles.blurButton}
>
🌊 Blur
</button>
</div>
</div>
}
}}
/>
)}

{!imageData && !isLoading && !error && (
Expand All @@ -257,6 +234,29 @@ const TracyPage = () => {
</div>
)}
</div>

{imageData && !isLoading && (
<div className={styles.resultActions}>
<button onClick={downloadImage} className={styles.downloadButton}>
📥 Download
</button>
<button
id="copy-button"
onClick={copyToClipboard}
className={styles.copyButton}
>
📋 Copy to Clipboard
</button>
<button
id="blur-button"
onClick={blurImage}
disabled={isLoading}
className={styles.blurButton}
>
🌊 Blur
</button>
</div>
)}
</div>
</div>
</div>
Expand Down