Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wakatime support #2525

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions docs/HACKATIME.md
Original file line number Diff line number Diff line change
@@ -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.
<br><img src="https://cloud-4zw0i5hoc-hack-club-bot.vercel.app/1extensions.png" width="512px">

4. Select "Manage Extensions".
<br><img src="https://cloud-4zw0i5hoc-hack-club-bot.vercel.app/0extensions-mgr.png" width="512px">

5. Select "Load unpacked"
<br><img src="https://cloud-4zw0i5hoc-hack-club-bot.vercel.app/2loadpacked.png" width="512px">

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'.
<br><img src="https://cloud-4zw0i5hoc-hack-club-bot.vercel.app/3token.png" width="512px">

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).
23 changes: 22 additions & 1 deletion src/components/navbar-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import ShareRoomPopup from "./popups-etc/share-room";
import { PersistenceStateKind } from "../lib/state";

import {
IoBoat,
IoChevronDown,
IoLogoGithub,
IoPlay,
Expand All @@ -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 {
Expand Down Expand Up @@ -708,9 +710,28 @@ export default function EditorNavbar(props: EditorNavbarProps) {
</Button>
);
}

const [showHighSeasAnnouncement, setShowHighSeasAnnouncement] = useState(false);

const highSeasAnnouncementsSeenKey = "highSeasAnnouncementSeen"

useEffect(() => {
setShowHighSeasAnnouncement(
!localStorage.getItem(highSeasAnnouncementsSeenKey)
)
}, []);

const hideHighSeasAnnouncement = () => {
setShowHighSeasAnnouncement(false)
localStorage.setItem(highSeasAnnouncementsSeenKey, "true")
}

return (
<>
{showHighSeasAnnouncement && <div class={styles.highSeasAnnouncement}>
<div><IoBoat/><span>Coming from High Seas? You can still log your work - <a href="https://github.com/hackclub/sprig/blob/main/docs/HACKATIME.md">click here</a> to set it up for Sprig.</span></div>
<button onClick={hideHighSeasAnnouncement}>Don't show again</button>
</div> }
<nav class={styles.container}>
<ul class={styles.editorStats}>
<li
Expand Down Expand Up @@ -1419,4 +1440,4 @@ export default function EditorNavbar(props: EditorNavbarProps) {
)}
</>
);
}
}
36 changes: 35 additions & 1 deletion src/components/navbar.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@
max-width: 100%;
height: auto;
border-radius: 4px;
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.publishPopup {
Expand Down Expand Up @@ -485,4 +485,38 @@

.newPRButton {
margin-left: 10px;
}

.highSeasAnnouncement {
display: flex;
justify-content: space-between;
font-size: 1em;
padding: 7px 20px;
background-color: #075389;
color: white;
}

.highSeasAnnouncement * a {
color: white;
text-decoration: underline;
}

.highSeasAnnouncement > div {
display: flex;
align-items: center;
padding: 3px 0px;
}

.highSeasAnnouncement > div > svg {
margin-right: 10px
}

.highSeasAnnouncement > button {
background: #0a75c2;
border: none;
color: white;
font-size: inherit;
padding: 0px 10px;
height: 100%;
cursor: pointer;
}
Loading