Skip to content

Commit 3e8748b

Browse files
committed
feat: actually get camera index from arg
1 parent a96bb26 commit 3e8748b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+3610
-0
lines changed

.nycrc

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"extends": "@istanbuljs/nyc-config-typescript",
3+
"extension": [
4+
".svelte",
5+
".ts"
6+
],
7+
"reporter": [
8+
"lcov",
9+
"text",
10+
"html",
11+
"json"
12+
],
13+
"all": true
14+
}

admin/src/lib/userStore.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import type { Writable } from 'svelte/store';
2+
import { writable } from 'svelte/store';
3+
4+
interface User {
5+
username: string;
6+
id: string;
7+
}
8+
9+
const user: Writable<User | undefined> = writable();
10+
11+
export default user;
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { Entity, Property } from '@mikro-orm/core';
2+
import { compare, hash } from 'bcrypt';
3+
import { Exclude } from 'class-transformer';
4+
import { BaseEntity } from '../../entities/BaseEntity';
5+
6+
@Entity()
7+
export class User extends BaseEntity {
8+
@Property({ unique: true })
9+
public email: string;
10+
11+
@Property()
12+
public username: string;
13+
14+
@Property()
15+
@Exclude()
16+
private hash: string;
17+
18+
public async setPassword(pass: string) {
19+
this.hash = await hash(pass, 12);
20+
}
21+
22+
public async comparePassword(password: string) {
23+
return compare(password, this.hash);
24+
}
25+
}

backend/test/app.e2e-spec.ts

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { Test, TestingModule } from '@nestjs/testing';
2+
import { INestApplication } from '@nestjs/common';
3+
import * as request from 'supertest';
4+
import { AppModule } from './../src/app.module';
5+
6+
describe('AppController (e2e)', () => {
7+
let app: INestApplication;
8+
9+
beforeEach(async () => {
10+
const moduleFixture: TestingModule = await Test.createTestingModule({
11+
imports: [AppModule],
12+
}).compile();
13+
14+
app = moduleFixture.createNestApplication();
15+
await app.init();
16+
});
17+
18+
it('/ (GET)', () => {
19+
return request(app.getHttpServer())
20+
.get('/')
21+
.expect(200)
22+
.expect('Hello World!');
23+
});
24+
});

backend/vite.config.ts

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { defineConfig } from 'vite';
2+
import { VitePluginNode } from 'vite-plugin-node';
3+
4+
export default defineConfig({
5+
clearScreen: false,
6+
plugins: [
7+
...VitePluginNode({
8+
adapter: 'nest',
9+
appPath: './src/main.ts',
10+
tsCompiler: 'swc',
11+
}),
12+
],
13+
optimizeDeps: {
14+
exclude: [
15+
'@mikro-orm/postgresql',
16+
'@mikro-orm/core',
17+
'mongodb-client-encryption',
18+
'@mikro-orm/mariadb',
19+
],
20+
},
21+
});
+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<script>
2+
import { Button, createAlert } from '@plantarium/ui';
3+
import { Changelog } from '../../elements';
4+
import Report from '../../elements/Report.svelte';
5+
import { Tutor } from '../tutor';
6+
</script>
7+
8+
<div>
9+
<Button
10+
name="Tutorial"
11+
icon="hand"
12+
--bg="#303030"
13+
--text="white"
14+
on:click={() => Tutor.restart()}
15+
/>
16+
17+
<Button
18+
name="Report Bug"
19+
icon="exclamation"
20+
--bg="#303030"
21+
--text="white"
22+
on:click={() =>
23+
createAlert(Report, {
24+
timeout: 0,
25+
title: 'Report Bug',
26+
type: 'error',
27+
props: { mode: 'bug' },
28+
})}
29+
/>
30+
31+
<Button
32+
name="Request Feature"
33+
--bg="#303030"
34+
--text="white"
35+
on:click={() =>
36+
createAlert(Report, {
37+
timeout: 0,
38+
title: 'Request Feature',
39+
props: { mode: 'feat' },
40+
})}
41+
/>
42+
<Button
43+
name="Changelog"
44+
--bg="#303030"
45+
--text="white"
46+
on:click={() => createAlert(Changelog, { timeout: 0 })}
47+
/>
48+
</div>
49+
50+
<style lang="scss">
51+
div {
52+
display: flex;
53+
justify-content: center;
54+
flex-direction: column;
55+
}
56+
57+
div :global(button) {
58+
margin-bottom: 10px !important;
59+
}
60+
61+
div :global(div:last-child button) {
62+
margin-bottom: 0px !important;
63+
}
64+
</style>
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<script>
2+
import Report from './Report.svelte';
3+
</script>
4+
5+
<Report mode="bug" />

packages/helpers/.nycrc

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extension": [
3+
".ts"
4+
],
5+
"reporter": [
6+
"json"
7+
]
8+
}

packages/helpers/tests/aggregate.ts

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { test } from 'uvu';
2+
import * as assert from 'uvu/assert';
3+
import aggregate from '../src/aggregate';
4+
5+
class A {
6+
public propA = 'A';
7+
}
8+
9+
class B {
10+
public propB = 'B';
11+
}
12+
13+
test('aggregation works', () => {
14+
class C extends aggregate(A, B) {
15+
public propC = 'C';
16+
}
17+
18+
const c = new C();
19+
20+
assert.equal(c.propA, 'A');
21+
assert.equal(c.propB, 'B');
22+
assert.equal(c.propC, 'C');
23+
});
24+
25+
test.run();
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { test } from 'uvu';
2+
import * as assert from 'uvu/assert';
3+
import convertHexToRGB from '../src/convertHexToRGB';
4+
5+
test('convertsCorrectly', () => {
6+
assert.equal(convertHexToRGB('ff0000'), [1, 0, 0]);
7+
});
8+
9+
test('handlesShortHex', () => {
10+
assert.equal(convertHexToRGB('ff0'), [1, 1, 0]);
11+
});
12+
13+
test.run();

packages/helpers/tests/debounce.ts

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { test } from 'uvu';
2+
import * as assert from 'uvu/assert';
3+
import debounce from '../src/debounce';
4+
5+
const wait = (timeout) => new Promise((res) => setTimeout(res, timeout));
6+
7+
test('debouncesCorrectly', async () => {
8+
let i = 0;
9+
10+
const func = debounce(() => {
11+
i++;
12+
}, 200);
13+
14+
func();
15+
await wait(100);
16+
func();
17+
await wait(100);
18+
func();
19+
await wait(200);
20+
func(); // <-- this is the only func that should be called
21+
await wait(100);
22+
func();
23+
24+
assert.equal(i, 1);
25+
});
26+
27+
test.run();
+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import { test } from 'uvu';
2+
import * as assert from 'uvu/assert';
3+
import EventEmitter from '../src/EventEmitter';
4+
5+
test('instantiates', () => {
6+
const e = new EventEmitter();
7+
assert.ok(e);
8+
});
9+
10+
test('listener works', () => {
11+
let wasCalled = false;
12+
13+
const e = new EventEmitter();
14+
15+
e.on('test', () => {
16+
wasCalled = true;
17+
});
18+
19+
e.emit('test');
20+
21+
assert.equal(wasCalled, true);
22+
});
23+
24+
test('emitting with data works', () => {
25+
const e = new EventEmitter();
26+
27+
e.on('test', (data: string) => {
28+
assert.equal(data, 'send_data');
29+
});
30+
31+
e.emit('test', 'send_data');
32+
});
33+
34+
test('emitting once with data works', () => {
35+
const e = new EventEmitter();
36+
37+
e.once('test', (data: string) => {
38+
assert.equal(data, 'send_data_first');
39+
});
40+
41+
e.emit('test', 'send_data_first');
42+
e.emit('test', 'send_data_second');
43+
});
44+
45+
test('removing listeners works', () => {
46+
const e = new EventEmitter();
47+
48+
const removeListener = e.on('test', (data: string) => {
49+
assert.equal(data, 'send_data_first');
50+
});
51+
52+
e.emit('test', 'send_data_first');
53+
removeListener();
54+
e.emit('test', 'send_data_second');
55+
});
56+
57+
test.run();
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { test } from 'uvu';
2+
import * as assert from 'uvu/assert';
3+
import inputChanged from '../src/inputChanged';
4+
5+
test('works', () => {
6+
let currentNum = 0;
7+
8+
const func = inputChanged((num: number) => {
9+
assert.not.equal(num, currentNum);
10+
currentNum = num;
11+
});
12+
13+
func(1);
14+
func(1);
15+
func(1);
16+
func(0);
17+
func(5);
18+
func(2);
19+
});
20+
21+
test.run();
+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
@use '../variables.scss';
2+
3+
.search-container {
4+
padding: 2px;
5+
width: 100%;
6+
box-sizing: border-box;
7+
&.focused {
8+
background-color: variables.$fg;
9+
color: variables.$text;
10+
}
11+
}
12+
13+
.context-wrapper {
14+
z-index: 99;
15+
position: absolute;
16+
width: 100px;
17+
opacity: 0;
18+
transform: translateX(0px) translateY(0px) scale(0.7);
19+
transition: opacity 0.05s linear, transform 0.1s ease;
20+
pointer-events: none;
21+
22+
background-color: variables.$bg;
23+
border-radius: 5px;
24+
color: #707070;
25+
box-shadow: 0px 2px 3px rgba(0, 0, 0, 0.13), 1px 2px 2px rgba(0, 0, 0, 0.1),
26+
-1px -2px 2px rgba(0, 0, 0, 0.05);
27+
28+
input {
29+
width: 100%;
30+
box-sizing: border-box;
31+
background: variables.$green_gradient;
32+
33+
margin: 0;
34+
border-radius: 3px 3px 0px 0px;
35+
padding-top: 2px;
36+
margin-top: -2px;
37+
transform: translateY(-1px);
38+
}
39+
40+
p {
41+
top: 43px;
42+
left: 50px;
43+
margin: 0;
44+
padding: 0;
45+
width: fit-content;
46+
text-align: center;
47+
transform-origin: 50% 50%;
48+
}
49+
}
50+
51+
.context-visible {
52+
opacity: 1;
53+
pointer-events: all;
54+
transform: scale(1);
55+
}

packages/ui/.eslintrc

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "../../.eslintrc.js",
3+
"settings": {
4+
"svelte3/compiler-options": {
5+
"customElement": true
6+
}
7+
}
8+
}

0 commit comments

Comments
 (0)