mirror of
https://github.com/ManInDark/HabitTrove.git
synced 2026-03-09 20:09:50 +01:00
Compare commits
4 Commits
v0.2.29.0
...
c397f40239
| Author | SHA1 | Date | |
|---|---|---|---|
|
c397f40239
|
|||
|
244692d8f9
|
|||
|
bb2e4be41b
|
|||
|
|
b01c5dcd6a |
@@ -1,5 +1,11 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## Version 0.2.30
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
* Security: Updated Next.js from 15.2.3 to 15.5.7 to address CVE-2025-55182 (https://github.com/vercel/next.js/security/advisories/GHSA-9qr9-h5gf-34mp)
|
||||||
|
|
||||||
## Version 0.2.29
|
## Version 0.2.29
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -66,7 +66,23 @@ export default function DrawingCanvas({ initialDrawing, onSave, onClear }: Drawi
|
|||||||
}, [initialDrawing])
|
}, [initialDrawing])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
redrawCanvas()
|
const canvas = canvasRef.current
|
||||||
|
if (!canvas || !contextRef.current) return
|
||||||
|
|
||||||
|
const context = contextRef.current
|
||||||
|
context.clearRect(0, 0, canvas.width, canvas.height)
|
||||||
|
|
||||||
|
drawingHistory.forEach(stroke => {
|
||||||
|
if (stroke.points.length === 0) return
|
||||||
|
context.beginPath()
|
||||||
|
context.strokeStyle = stroke.color
|
||||||
|
context.lineWidth = stroke.thickness
|
||||||
|
context.moveTo(stroke.points[0].x, stroke.points[0].y)
|
||||||
|
stroke.points.forEach(point => {
|
||||||
|
context.lineTo(point.x, point.y)
|
||||||
|
})
|
||||||
|
context.stroke()
|
||||||
|
})
|
||||||
}, [drawingHistory])
|
}, [drawingHistory])
|
||||||
|
|
||||||
const getMousePos = (event: React.MouseEvent) => {
|
const getMousePos = (event: React.MouseEvent) => {
|
||||||
@@ -125,26 +141,6 @@ export default function DrawingCanvas({ initialDrawing, onSave, onClear }: Drawi
|
|||||||
contextRef.current?.closePath()
|
contextRef.current?.closePath()
|
||||||
}
|
}
|
||||||
|
|
||||||
const redrawCanvas = () => {
|
|
||||||
const canvas = canvasRef.current
|
|
||||||
if (!canvas || !contextRef.current) return
|
|
||||||
|
|
||||||
const context = contextRef.current
|
|
||||||
context.clearRect(0, 0, canvas.width, canvas.height)
|
|
||||||
|
|
||||||
drawingHistory.forEach(stroke => {
|
|
||||||
if (stroke.points.length === 0) return
|
|
||||||
context.beginPath()
|
|
||||||
context.strokeStyle = stroke.color
|
|
||||||
context.lineWidth = stroke.thickness
|
|
||||||
context.moveTo(stroke.points[0].x, stroke.points[0].y)
|
|
||||||
stroke.points.forEach(point => {
|
|
||||||
context.lineTo(point.x, point.y)
|
|
||||||
})
|
|
||||||
context.stroke()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleUndo = () => {
|
const handleUndo = () => {
|
||||||
setDrawingHistory(prevHistory => {
|
setDrawingHistory(prevHistory => {
|
||||||
const newHistory = [...prevHistory]
|
const newHistory = [...prevHistory]
|
||||||
|
|||||||
@@ -3,14 +3,14 @@ import Link from 'next/link';
|
|||||||
import { usePathname } from 'next/navigation';
|
import { usePathname } from 'next/navigation';
|
||||||
import { NavItemType } from './Navigation';
|
import { NavItemType } from './Navigation';
|
||||||
|
|
||||||
export default function NavDisplay({ navItems, isMobile }: { navItems: NavItemType[], isMobile: boolean }) {
|
export default function NavDisplay({ navItems, displayType }: { navItems: NavItemType[], displayType: 'main' | 'mobile' }) {
|
||||||
const pathname = usePathname();
|
const pathname = usePathname();
|
||||||
const { isIOS } = useHelpers()
|
const { isIOS } = useHelpers()
|
||||||
|
|
||||||
if (isMobile) {
|
if (displayType === 'mobile') {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{isMobile && (<div className={isIOS ? "pb-20" : "pb-16"} />)}
|
<div className={isIOS ? "pb-20" : "pb-16"} />
|
||||||
<nav className={`lg:hidden fixed bottom-0 left-0 right-0 bg-white dark:bg-gray-800 shadow-lg ${isIOS ? "pb-4" : ""}`}>
|
<nav className={`lg:hidden fixed bottom-0 left-0 right-0 bg-white dark:bg-gray-800 shadow-lg ${isIOS ? "pb-4" : ""}`}>
|
||||||
<div className="grid grid-cols-6 w-full">
|
<div className="grid grid-cols-6 w-full">
|
||||||
{navItems.map((item) => (
|
{navItems.map((item) => (
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import { HabitIcon, TaskIcon } from '@/lib/constants'
|
import { HabitIcon, TaskIcon } from '@/lib/constants'
|
||||||
import { Calendar, Coins, Gift, Home } from 'lucide-react'
|
import { Calendar, Coins, Gift, Home } from 'lucide-react'
|
||||||
import { useTranslations } from 'next-intl'
|
import { useTranslations } from 'next-intl'
|
||||||
import { ElementType, useEffect, useState } from 'react'
|
import { ElementType } from 'react'
|
||||||
import NavDisplay from './NavDisplay'
|
import NavDisplay from './NavDisplay'
|
||||||
|
|
||||||
export interface NavItemType {
|
export interface NavItemType {
|
||||||
@@ -14,13 +14,6 @@ export interface NavItemType {
|
|||||||
|
|
||||||
export default function Navigation({ position }: { position: 'main' | 'mobile' }) {
|
export default function Navigation({ position }: { position: 'main' | 'mobile' }) {
|
||||||
const t = useTranslations('Navigation');
|
const t = useTranslations('Navigation');
|
||||||
const [isMobile, setIsMobile] = useState(window.innerWidth < 1024);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const handleResize = () => {setIsMobile(window.innerWidth < 1024); };
|
|
||||||
window.addEventListener("resize", handleResize);
|
|
||||||
return () => window.removeEventListener("resize", handleResize);
|
|
||||||
}, [setIsMobile]);
|
|
||||||
|
|
||||||
const currentNavItems: NavItemType[] = [
|
const currentNavItems: NavItemType[] = [
|
||||||
{ icon: Home, label: t('dashboard'), href: '/' },
|
{ icon: Home, label: t('dashboard'), href: '/' },
|
||||||
@@ -31,10 +24,5 @@ export default function Navigation({ position }: { position: 'main' | 'mobile' }
|
|||||||
{ icon: Coins, label: t('coins'), href: '/coins' },
|
{ icon: Coins, label: t('coins'), href: '/coins' },
|
||||||
]
|
]
|
||||||
|
|
||||||
if ((position === 'mobile' && isMobile) || (position === 'main' && !isMobile)) {
|
return <NavDisplay navItems={currentNavItems} displayType={position} />
|
||||||
return <NavDisplay navItems={currentNavItems} isMobile={isMobile} />
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return <></>
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
595
package-lock.json
generated
595
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "habittrove",
|
"name": "habittrove",
|
||||||
"version": "0.2.29",
|
"version": "0.2.30",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev --turbopack",
|
"dev": "next dev --turbopack",
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"lucide-react": "^0.469.0",
|
"lucide-react": "^0.469.0",
|
||||||
"luxon": "^3.5.0",
|
"luxon": "^3.5.0",
|
||||||
"next": "15.2.3",
|
"next": "^v15.5.7",
|
||||||
"next-auth": "^5.0.0-beta.25",
|
"next-auth": "^5.0.0-beta.25",
|
||||||
"next-intl": "^4.1.0",
|
"next-intl": "^4.1.0",
|
||||||
"next-themes": "^0.4.4",
|
"next-themes": "^0.4.4",
|
||||||
|
|||||||
Reference in New Issue
Block a user