diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 000000000..0542b110d --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,49 @@ +name: Deploy + +on: + push: + branches: + - main + +jobs: + build: + name: Build + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + + - name: Install dependencies + uses: bahmutov/npm-install@v1 + + - name: Build project + run: npm run build + + - name: Upload production-ready build files + uses: actions/upload-artifact@v4 + with: + name: production-files + path: ./dist + + deploy: + name: Deploy + needs: build + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/main' + + steps: + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: production-files + path: ./dist + + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./dist \ No newline at end of file diff --git a/src/App.jsx b/src/App.jsx index 14a7f684d..6de0c13f2 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,14 +1,32 @@ +import React, { useState } from "react"; import './App.css'; +import ChatLog from './components/ChatLog'; +import chat from './data/messages.json'; const App = () => { + const [chatMessages, setChatMessages] = useState(chat); + + const toggleLike = (id) => { + const updatedMessages = chatMessages.map((entry) => { + if (entry.id === id) { + return { ...entry, liked: !entry.liked }; + } else { + return entry; + } + }); + setChatMessages(updatedMessages); + }; + + const totalLikes = chatMessages.filter((entry) => entry.liked).length; + return (
{totalLikes} ❤️s
Replace with body of ChatEntry
-Replace with TimeStamp component
- +{body}
+