JS frontend stuff
Move old ember frontend to properly named folder Add vue based new frontend
This commit is contained in:
parent
8947d97825
commit
88398334fe
254 changed files with 837 additions and 0 deletions
0
frontend-old-ember/app/helpers/.gitkeep
Normal file
0
frontend-old-ember/app/helpers/.gitkeep
Normal file
7
frontend-old-ember/app/helpers/equals.ts
Normal file
7
frontend-old-ember/app/helpers/equals.ts
Normal file
|
@ -0,0 +1,7 @@
|
|||
import { helper } from '@ember/component/helper';
|
||||
|
||||
export default helper(function equals(args) {
|
||||
if (args.length != 2) return false;
|
||||
console.log(args[0], args[1]);
|
||||
return args[0] == args[1];
|
||||
});
|
24
frontend-old-ember/app/helpers/formatter.ts
Normal file
24
frontend-old-ember/app/helpers/formatter.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
import { helper } from '@ember/component/helper'
|
||||
|
||||
class Token {
|
||||
declare token: string
|
||||
declare elements: Array<string | Token>
|
||||
|
||||
public constructor(token: string) {
|
||||
this.token = token
|
||||
this.elements = new Array()
|
||||
}
|
||||
}
|
||||
|
||||
export default helper(function formatter(
|
||||
positional: Array<string>,
|
||||
named: {
|
||||
matchers: Array<{ match: RegExp; replace: string }>
|
||||
},
|
||||
): string {
|
||||
let out = positional[0] ?? ''
|
||||
named.matchers.forEach((x) => {
|
||||
out = out.replaceAll(x.match, x.replace)
|
||||
})
|
||||
return out
|
||||
})
|
14
frontend-old-ember/app/helpers/is-valid-mail.ts
Normal file
14
frontend-old-ember/app/helpers/is-valid-mail.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
import { helper } from '@ember/component/helper';
|
||||
|
||||
const re = /.+@\S+\.\S+/;
|
||||
|
||||
// Helper to check if a given email is *probably* valid
|
||||
// Ofc, the only surefire way to check if an email exists is to send a test mail to it.
|
||||
// This sending is expensive however, and thus some mostly sane defaults can be checked for
|
||||
// beforehand. "Bananentürkis" for example is obviously not a valid address
|
||||
export default helper(function isValidMail(positional: string[] /*, named*/) {
|
||||
for (const mail of positional) {
|
||||
if (!re.test(mail)) return false;
|
||||
}
|
||||
return true;
|
||||
});
|
6
frontend-old-ember/app/helpers/isLandscape.ts
Normal file
6
frontend-old-ember/app/helpers/isLandscape.ts
Normal file
|
@ -0,0 +1,6 @@
|
|||
export default function isLandscape(): boolean {
|
||||
return (
|
||||
Math.min(screen.availHeight, window.innerHeight) <
|
||||
Math.min(screen.availWidth, window.innerWidth)
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue