autocommit 18-07-2024-06-42

This commit is contained in:
Jasen Qin 2024-07-18 06:42:11 +10:00
parent c2d5f513dc
commit 31d412d55a
7 changed files with 79 additions and 23 deletions

View File

@ -1,21 +0,0 @@
---
title: UserFlow Diagram
date: 2024-07-17
tags: [diagram, UserFlow]
---
import DiagramViewer from '@site/src/components/DiagramViewer';
# UserFlow Diagram
<DiagramViewer code={`
graph TD
A[Start] --> B{Login?}
B -->|Yes| C[Dashboard]
B -->|No| D[Registration]
D --> C
`} />
[Additional explanation or notes]

View File

@ -8,6 +8,6 @@ import MockupGallery from '@site/src/components/MockupGallery';
# LoginScreen Mockup # LoginScreen Mockup
<MockupGallery images={['/img/mockups/login-screen-v1.png']} /> <MockupGallery images={["/img/manta.jpg"]} />
[Additional description or notes] [Additional description or notes]

View File

@ -4,6 +4,13 @@ date: 2024-07-17
tags: [observation, UserInterface] tags: [observation, UserInterface]
--- ---
import ResultsVisualizer from '@site/src/components/ResultsVisualizer';
# UserInterface Observation # UserInterface Observation
[Your content here] Today I noticed that the sky was bluer than usual. I am not entirely sure why. It really stood out to me.
<ResultsVisualizer
data={{labels: ['1', '2', '3', '4', '5'], data: [5, 6, 7, 8, 9]}}
chartType="line"
/>

View File

@ -20,6 +20,7 @@
"@docusaurus/theme-live-codeblock": "^3.4.0", "@docusaurus/theme-live-codeblock": "^3.4.0",
"@docusaurus/theme-mermaid": "^3.4.0", "@docusaurus/theme-mermaid": "^3.4.0",
"@mdx-js/react": "^3.0.0", "@mdx-js/react": "^3.0.0",
"chart.js": "^4.4.3",
"clsx": "^2.0.0", "clsx": "^2.0.0",
"docusaurus-lunr-search": "^3.4.0", "docusaurus-lunr-search": "^3.4.0",
"prism-react-renderer": "^2.3.0", "prism-react-renderer": "^2.3.0",

View File

@ -0,0 +1,57 @@
import React, { useEffect, useRef, useState } from 'react'
import Chart from 'chart.js/auto'
const ResultsVisualizer = ({ data, chartType = 'line' }) => {
const chartRef = useRef(null)
const [figureNumber, setFigureNumber] = useState(1)
useEffect(() => {
// Find the current highest figure number in the document
const figures = document.querySelectorAll('[data-figure-number]')
const highestFigure = Math.max(...Array.from(figures).map(fig => parseInt(fig.dataset.figureNumber, 10)), 0)
setFigureNumber(highestFigure + 1)
}, [])
useEffect(() => {
if (chartRef.current) {
const ctx = chartRef.current.getContext('2d')
// Destroy existing chart if it exists
if (chartRef.current.chart) {
chartRef.current.chart.destroy()
}
// Create new chart
chartRef.current.chart = new Chart(ctx, {
type: chartType,
data: {
labels: data.labels,
datasets: [{
label: `Figure ${figureNumber}`,
data: data.data,
fill: false,
borderColor: 'rgb(75, 192, 192)',
tension: 0.1
}]
},
options: {
responsive: true,
plugins: {
title: {
display: true,
text: `Figure ${figureNumber}`
}
}
}
})
}
}, [data, chartType, figureNumber])
return (
<div data-figure-number={figureNumber}>
<canvas ref={chartRef}></canvas>
</div>
)
}
export default ResultsVisualizer

BIN
static/img/manta.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@ -1774,6 +1774,11 @@
"@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/resolve-uri" "^3.1.0"
"@jridgewell/sourcemap-codec" "^1.4.14" "@jridgewell/sourcemap-codec" "^1.4.14"
"@kurkle/color@^0.3.0":
version "0.3.2"
resolved "https://registry.yarnpkg.com/@kurkle/color/-/color-0.3.2.tgz#5acd38242e8bde4f9986e7913c8fdf49d3aa199f"
integrity sha512-fuscdXJ9G1qb7W8VdHi+IwRqij3lBkosAm4ydQtEmbY58OzHXqQhvlxqEkoz0yssNVn38bcpRWgA9PP+OGoisw==
"@leichtgewicht/ip-codec@^2.0.1": "@leichtgewicht/ip-codec@^2.0.1":
version "2.0.5" version "2.0.5"
resolved "https://registry.yarnpkg.com/@leichtgewicht/ip-codec/-/ip-codec-2.0.5.tgz#4fc56c15c580b9adb7dc3c333a134e540b44bfb1" resolved "https://registry.yarnpkg.com/@leichtgewicht/ip-codec/-/ip-codec-2.0.5.tgz#4fc56c15c580b9adb7dc3c333a134e540b44bfb1"
@ -3084,6 +3089,13 @@ character-reference-invalid@^2.0.0:
resolved "https://registry.yarnpkg.com/character-reference-invalid/-/character-reference-invalid-2.0.1.tgz#85c66b041e43b47210faf401278abf808ac45cb9" resolved "https://registry.yarnpkg.com/character-reference-invalid/-/character-reference-invalid-2.0.1.tgz#85c66b041e43b47210faf401278abf808ac45cb9"
integrity sha512-iBZ4F4wRbyORVsu0jPV7gXkOsGYjGHPmAyv+HiHG8gi5PtC9KI2j1+v8/tlibRvjoWX027ypmG/n0HtO5t7unw== integrity sha512-iBZ4F4wRbyORVsu0jPV7gXkOsGYjGHPmAyv+HiHG8gi5PtC9KI2j1+v8/tlibRvjoWX027ypmG/n0HtO5t7unw==
chart.js@^4.4.3:
version "4.4.3"
resolved "https://registry.yarnpkg.com/chart.js/-/chart.js-4.4.3.tgz#3b2e11e7010fefa99b07d0349236f5098e5226ad"
integrity sha512-qK1gkGSRYcJzqrrzdR6a+I0vQ4/R+SoODXyAjscQ/4mzuNzySaMCd+hyVxitSY1+L2fjPD1Gbn+ibNqRmwQeLw==
dependencies:
"@kurkle/color" "^0.3.0"
cheerio-select@^2.1.0: cheerio-select@^2.1.0:
version "2.1.0" version "2.1.0"
resolved "https://registry.yarnpkg.com/cheerio-select/-/cheerio-select-2.1.0.tgz#4d8673286b8126ca2a8e42740d5e3c4884ae21b4" resolved "https://registry.yarnpkg.com/cheerio-select/-/cheerio-select-2.1.0.tgz#4d8673286b8126ca2a8e42740d5e3c4884ae21b4"