Skip to content

Commit

Permalink
Merge branch 'master' into import-limit-notify
Browse files Browse the repository at this point in the history
  • Loading branch information
johndoknjas authored Dec 19, 2024
2 parents 4d8c6df + 4082e63 commit 75942cc
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
6 changes: 5 additions & 1 deletion modules/clas/src/main/ClasApi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,11 @@ final class ClasApi(

def move(s: Student.WithUser, toClas: Clas)(using teacher: Me): Fu[Option[Student]] = for
_ <- closeAccount(s)
stu = s.student.copy(id = Student.makeId(s.user.id, toClas.id), clasId = toClas.id)
stu = s.student.copy(
id = Student.makeId(s.user.id, toClas.id),
clasId = toClas.id,
created = Clas.Recorded(by = teacher.userId, at = nowInstant)
)
moved <- colls.student.insert
.one(stu)
.inject(stu.some)
Expand Down
18 changes: 16 additions & 2 deletions ui/.build/src/sass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,16 +235,30 @@ async function parseScss(src: string) {
async function parseThemeColorDefs() {
const themeFiles = await globArray('./common/css/theme/_*.scss', { absolute: false });
const themes: string[] = ['dark'];
const capturedColors = new Map<string, string>();
for (const themeFile of themeFiles ?? []) {
const theme = /_([^/]+)\.scss/.exec(themeFile)?.[1];
if (!theme) {
env.log(`${errorMark} - invalid theme filename '${c.cyan(themeFile)}'`, { ctx: 'sass' });
continue;
}
const text = fs.readFileSync(themeFile, 'utf8');
const colorMap = new Map<string, clr.Instance>();
for (const match of text.matchAll(/\s\$c-([-a-z0-9]+):\s*([^;]+);/g)) {
colorMap.set(match[1], clr(match[2]));
capturedColors.set(match[1], match[2]);
}
const colorMap = new Map<string, clr.Instance>();
for (const [color, colorVal] of capturedColors) {
let val = colorVal;
const visitedVariables = new Set();
while (val.startsWith('$')) {
const inferredValue = capturedColors.get(val.substring(3)) ?? '#000';
if (visitedVariables.has(inferredValue)) {
break;
}
visitedVariables.add(inferredValue);
val = inferredValue;
}
colorMap.set(color, clr(val));
}
if (theme !== 'default') themes.push(theme);
themeColorMap.set(theme, colorMap);
Expand Down
2 changes: 1 addition & 1 deletion ui/common/css/theme/_default.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ $c-shade: hsl(0, 0%, 30%);
$c-inaccuracy: hsl(202, 78%, 62%);
$c-mistake: hsl(41, 100%, 45%);
$c-blunder: hsl(0, 69%, 60%);
$c-good: $c-secondary;
$c-good: hsl(88, 62%, 37%);
$c-brilliant: hsl(129, 71%, 45%);
$c-interesting: hsl(307, 80%, 70%);
$c-paper: hsl(60, 56%, 91%);
Expand Down

0 comments on commit 75942cc

Please sign in to comment.