From 25cecb6433617f21bfb1d22581dc8f438ab51389 Mon Sep 17 00:00:00 2001 From: Cheru Berhanu Date: Thu, 31 Oct 2024 11:47:49 -0400 Subject: [PATCH 1/2] wakatime support --- docs/HACKATIME.md | 15 +++++++++++++ src/components/navbar-editor.tsx | 21 +++++++++++++++++++ src/components/navbar.module.css | 36 +++++++++++++++++++++++++++++++- 3 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 docs/HACKATIME.md diff --git a/docs/HACKATIME.md b/docs/HACKATIME.md new file mode 100644 index 0000000000..8fab0134ba --- /dev/null +++ b/docs/HACKATIME.md @@ -0,0 +1,15 @@ +1. Download the [hackatime extension](http://hack.club/hackatime-web-extension) +2. Unzip the contents of the directory. +3. Open Google Chrome. Select the "Extensions" dropdown. +
+ +4. Select "Manage Extensions". +
+ +5. Select "Load unpacked" +
+ +6. A page will appear asking for your Hack Club wakatime API key (find it [here](https://waka.hackclub.com)). Enter your API key, and select 'Submit'. +
+ +7. Navigate to sprig.hackclub.com, open the editor, and start working. You should see waka heartbeats coming in on Hack Club's [waka portal dashboard](https://waka.hackclub.com). diff --git a/src/components/navbar-editor.tsx b/src/components/navbar-editor.tsx index 52f6016d01..bd9208662a 100644 --- a/src/components/navbar-editor.tsx +++ b/src/components/navbar-editor.tsx @@ -23,6 +23,7 @@ import ShareRoomPopup from "./popups-etc/share-room"; import { PersistenceStateKind } from "../lib/state"; import { + IoBoat, IoChevronDown, IoLogoGithub, IoPlay, @@ -41,6 +42,7 @@ import { collapseRanges } from "../lib/codemirror/util"; import { foldAllTemplateLiterals, onRun} from "./big-interactive-pages/editor"; import { showKeyBinding } from '../lib/state'; import { validateGitHubToken, forkRepository, createBranch, createCommit, fetchLatestCommitSha, createTreeAndCommit, createPullRequest, fetchForkedRepository, updateBranch, createBlobForImage } from "../lib/game-saving/github"; +import {useEffect, useState} from "preact/hooks"; const saveName = throttle(500, async (gameId: string, newName: string) => { try { @@ -708,9 +710,28 @@ export default function EditorNavbar(props: EditorNavbarProps) { ); } + + const [showHighSeasAnnouncement, setShowHighSeasAnnouncement] = useState(false); + + const highSeasAnnouncementsSeenKey = "highSeasAnnouncementSeen" + + useEffect(() => { + setShowHighSeasAnnouncement( + !localStorage.getItem(highSeasAnnouncementsSeenKey) + ) + }, []); + + const hideHighSeasAnnouncement = () => { + setShowHighSeasAnnouncement(false) + localStorage.setItem(highSeasAnnouncementsSeenKey, "true") + } return ( <> + {showHighSeasAnnouncement &&
+
Coming from High Seas? You can still log your work - click here to set it up for Sprig.
+ +
}