diff --git a/app/LandingPage.tsx b/app/LandingPage.tsx index ae6c9f0..d5e54f4 100644 --- a/app/LandingPage.tsx +++ b/app/LandingPage.tsx @@ -8,7 +8,7 @@ const Home = () => {

About Us

- We are a group of informatics students from IMS (Informatik Schule Sargans), currently learning React to prepare for an upcoming project. This project will be part of our traineeship at a company, where we'll apply our skills in a real-world setting. Our coursework in React is equipping us with the knowledge and experience needed to excel in this practical opportunity. + We are a group of IT students from IMS (Informatikmittelschule), currently learning React to prepare for an upcoming project. This project will be part of our traineeship at a company, where we'll apply our skills in a real-world setting. Our coursework in React is equipping us with the knowledge and experience needed to excel in this practical opportunity.

@@ -24,7 +24,7 @@ const Home = () => {
- Sage + Luca

Luca

Luca, Patrick's co-programmer, is skilled in Java, GDScript, Bash, and Basic Typewriter. His expertise in Java and GDScript supports robust application and game development, while his Bash scripting skills streamline automation. His knowledge of Basic Typewriter adds a classic touch to his versatile programming capabilities. @@ -33,8 +33,8 @@ const Home = () => {

- - Norway + + Yasin

Yasin

Yasin is a proficient programmer with expertise in Java, where he has even developed games, as well as Bash, HTML, CSS, SQL, and NoSQL. His skills span from backend development and automation to web design and database management, making him a versatile asset in any tech project. diff --git a/app/patrick/Patrick.tsx b/app/patrick/Patrick.tsx index e1f02aa..bbb5893 100644 --- a/app/patrick/Patrick.tsx +++ b/app/patrick/Patrick.tsx @@ -1,13 +1,80 @@ // Patrick.tsx -"use client"; -import React from 'react'; -import './Patrick.css'; // Import specific styles for Patrick +import React, { useRef, useEffect } from 'react'; +import './Patrick.css'; -const Patrick = () => ( -

-

Patrick's Space

-

Welcome, Patrick! This is your programming space.

-
-); +const Patrick: React.FC = () => { + const canvasRef = useRef(null); + const contextRef = useRef(null); + var isPressed = false; + + useEffect(() => { + const canvas = canvasRef.current; + if (canvas) { + canvas.width = 1000; // Set canvas width + canvas.height = 500; // Set canvas height + const context = canvas.getContext('2d'); + if (context) { + contextRef.current = context; + // Fill the canvas with a color + context.fillStyle = 'black'; + context.fillRect(0, 0, canvas.width, canvas.height); + } + } + }, []); + + const manipulatePixel = (x: number, y: number) => { + const context = contextRef.current; + if (context) { + // Get the pixel data + const imageData = context.getImageData(x, y, 1, 1); + const data = imageData.data; + + // Manipulate the pixel (invert color) + data[0] = 255; // Red + data[1] = 255; // Green + data[2] = 255; // Blue + context.putImageData(imageData, x, y); + context.putImageData(imageData, x+1, y); + context.putImageData(imageData, x-1, y); + context.putImageData(imageData, x, y+1); + context.putImageData(imageData, x, y-1); + } + }; + + const handleClick = (event: React.MouseEvent) => { + const canvas = canvasRef.current; + if (canvas && isPressed) { + const rect = canvas.getBoundingClientRect(); + const x = Math.floor(event.clientX - rect.left); + const y = Math.floor(event.clientY - rect.top); + manipulatePixel(x, y); + } else { + isPressed = false; + } + }; + + const moveDown = (event: React.MouseEvent) => { + isPressed = true; + handleClick(event) + }; + + const moveUp = () => { + isPressed = false; + }; + + return ( +
+

Welcome to Patrick-Paintâ„¢.

+

+ +
+ ); +}; export default Patrick; diff --git a/next.config.mjs b/next.config.mjs index 4678774..4eef611 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -1,4 +1,6 @@ /** @type {import('next').NextConfig} */ -const nextConfig = {}; +const nextConfig = { + basePath: '/react', +}; export default nextConfig; diff --git a/package.json b/package.json index e01ae73..f4e81ff 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "private": true, "scripts": { - "dev": "next dev", + "dev": "next dev -p 3001", "build": "next build", "start": "next start", "lint": "next lint"