-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b098be3
commit 1ec578a
Showing
7 changed files
with
175 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { useEffect, useState } from "react"; | ||
|
||
export const useChangelog = ()=>{ | ||
|
||
const [changelog, setContent] = useState(); | ||
const [error, setError] = useState(); | ||
const [loading, setLoading] = useState(true); | ||
|
||
useEffect(async () => { | ||
|
||
try { | ||
const resp = await fetch("/changelog.txt"); | ||
const txt = await resp.text(); | ||
setLoading(false); | ||
setContent(txt); | ||
} | ||
catch (e) { | ||
setError("Failed to load the log for some reason..."); | ||
} | ||
|
||
}, []); | ||
|
||
return { | ||
changelog, error, loading | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { useChangelog } from "./useChangelog" | ||
|
||
var collaborators; | ||
|
||
/** | ||
* returns a function that can be used to check if a user has given feedback for a given version. | ||
* Given a username, it will return the VERSIONS in which it has collabed. | ||
*/ | ||
export const useHasGivenFeedback = ()=>{ | ||
const { changelog } = useChangelog(); | ||
|
||
if( changelog ) | ||
{ | ||
return uname => { | ||
|
||
if( !collaborators ) | ||
{ | ||
collaborators = new Map(); | ||
|
||
var lastVersion = null; | ||
|
||
//console.group("COLABS"); | ||
changelog.split("\n").forEach( line=>{ | ||
|
||
let m = line.match(/- +(\d+\.\d+\.\d+)\s+:/); | ||
if( m ) | ||
{ | ||
lastVersion = line.replace("- ",""); | ||
} | ||
else | ||
{ | ||
const regex = /@([a-z0-9_]+)/gi; | ||
|
||
while ((m = regex.exec(line)) !== null) { | ||
if (m.index === regex.lastIndex) { | ||
regex.lastIndex++; | ||
} | ||
|
||
// The result can be accessed through the `m`-variable. | ||
m.forEach((uname, groupIndex) => { | ||
|
||
if( groupIndex==0 ) return; | ||
|
||
//console.log( uname, lastVersion) | ||
const what = lastVersion + " | " + line; | ||
|
||
if( !collaborators.has(uname) ) | ||
{ | ||
collaborators.set(uname, [what]); | ||
} | ||
else | ||
{ | ||
collaborators.get(uname).push(what); | ||
} | ||
|
||
}); | ||
} | ||
|
||
} | ||
|
||
}); | ||
//console.groupEnd(); | ||
} | ||
|
||
return collaborators.get( uname ); | ||
|
||
} | ||
} | ||
|
||
return null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"buildMajor":"2","buildMinor":27,"buildRevision":2,"buildTag":"RELEASE","when":"Sat, 16 Mar 2024 12:49:06 GMT"} | ||
{"buildMajor":"2","buildMinor":27,"buildRevision":3,"buildTag":"RELEASE","when":"Mon, 18 Mar 2024 08:20:30 GMT"} |