diff --git a/.gitea/workflows/main.yml b/.gitea/workflows/main.yml new file mode 100644 index 0000000..c433315 --- /dev/null +++ b/.gitea/workflows/main.yml @@ -0,0 +1,52 @@ +name: CI/CD Pipeline + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build-and-test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: '18' + + - name: Install dependencies + run: npm ci + + - name: Run linter + run: npm run lint + + - name: Build + run: npm run build + + docker: + needs: build-and-test + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to Gitea Container Registry + uses: docker/login-action@v1 + with: + registry: git.dws.rip + username: ${{ secrets.GITEA_USERNAME }} + password: ${{ secrets.GITEA_PASSWORD }} + + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: git.dws.rip/${{ secrets.GITEA_USERNAME }}/terminaltinder:latest diff --git a/app/components/HistoryPopup.tsx b/app/components/HistoryPopup.tsx index 9ee368d..e1312a8 100644 --- a/app/components/HistoryPopup.tsx +++ b/app/components/HistoryPopup.tsx @@ -1,14 +1,15 @@ import React from 'react'; -import { ColorScheme } from '../utils/colorSchemes'; +import { ColorScheme, encodeThemeForUrl } from '../utils/colorSchemes'; import { generateYAML, generateJSON, generateXResources, generateTOML } from '../utils/exportFormats'; import Image from 'next/image'; import ColorPalette from './ColorPalette'; +import { useRouter } from 'next/navigation'; interface HistoryPopupProps { likedSchemes: ColorScheme[]; dislikedSchemes: ColorScheme[]; onClose: () => void; - onClearHistory: () => void; // Add this line + onClearHistory: () => void; isDarkMode: boolean; outputFormat: string; } @@ -17,10 +18,12 @@ const HistoryPopup: React.FC = ({ likedSchemes, dislikedSchemes, onClose, - onClearHistory, // Add this line + onClearHistory, isDarkMode, outputFormat }) => { + const router = useRouter(); + const handleDownload = (scheme: ColorScheme) => { let content: string; let fileExtension: string; @@ -55,19 +58,31 @@ const HistoryPopup: React.FC = ({ URL.revokeObjectURL(url); }; + const handleThemeClick = (scheme: ColorScheme) => { + const encodedTheme = encodeThemeForUrl(scheme); + router.push(`/share/${encodedTheme}`); + }; + const renderSchemeGrid = (schemes: ColorScheme[], title: string) => (

{title}

{schemes.map((scheme, index) => ( -
+
handleThemeClick(scheme)} + >

{scheme.name}