Skip to content

Commit e51f8af

Browse files
authored
Merge pull request #325 from sas-fossdev/v2feature/ui
Fix UI issues and minor errors
2 parents 38b97fd + f1042cc commit e51f8af

26 files changed

+1102
-181
lines changed

.env

Lines changed: 0 additions & 1 deletion
This file was deleted.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ lerna-debug.log*
99

1010
node_modules
1111
dist
12+
dist.zip
1213
dist-ssr
1314
*.local
1415

CONTRIBUTING.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Contributing
2+
The main branch for version 2 is v2. Do not force push into it; please create pull requests.
3+
4+
This is a work in progress, so documentation files such as this and README.md are not fully fleshed out. Any help in this would be appreciated.
5+
6+
If you want to make a new feature, please create an issue for it and link it in your pull request.
7+
8+
### License Header
9+
10+
If you modify an existing file, add your copyright notice to the file. Something like this:
11+
```
12+
@copyright Copyright (c) <year> <your name> <<your email address>>
13+
```
14+
For a new file, add this license header to the top of the file:
15+
```
16+
/**
17+
*
18+
* @copyright Copyright (c) <year> <your name> <<your email address>>
19+
*
20+
* @author <your name> <<your email address>>
21+
*
22+
* @license GNU AGPL version 3 only
23+
*
24+
* SAS Powerschool Enhancement Suite - A browser extension to improve the experience of SAS Powerschool.
25+
*
26+
* This program is free software: you can redistribute it and/or modify
27+
* it under the terms of the GNU Affero General Public License as
28+
* published by the Free Software Foundation, version 3.
29+
*
30+
* This program is distributed in the hope that it will be useful,
31+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
32+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33+
* GNU Affero General Public License for more details.
34+
*
35+
* You should have received a copy of the GNU Affero General Public License
36+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
37+
*
38+
*/
39+
```

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@
22
<img src="https://cdn.ydgkim.com/gschool/saspes/mainimage.png" alt="SAS Powerschool Enhancement Suite" height="200">
33
</p>
44

5+
# SAS PES v2
6+
57
SAS PES is an extension using the WebExtension standard for use by **Singapore American School students only**. The extension provides various enhancements when using Powerschool at SAS.
68

79
Regardless of what the extension calculates, teachers are able to override the final grade. **DO NOT RELY ON THE DATA FROM THIS EXTENSION!!**
810

11+
Version 2 aims to fix all the current problems with the extension, modernize the code, and add new features students would like.
12+
13+
## Contributing
14+
15+
Please see [CONTRIBUTING.md](./CONTRIBUTING.md).

manifest.config.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
import { defineManifest } from '@crxjs/vite-plugin'
22
import packageJson from './package.json'
3+
import 'dotenv/config'
34
const { version } = packageJson
45

56

67

8+
export const realVersion = `${new Date().getUTCFullYear()}.${new Date().getUTCMonth() + 1}${String(new Date().getUTCDate()).padStart(2, "0")}.${new Date().getUTCMinutes()}${String(new Date().getUTCHours()).padStart(2, "0")}.${new Date().getUTCSeconds()}${String(new Date().getUTCMilliseconds()).padStart(3, "0")}`;
79
export default defineManifest(async (env) => ({
810
manifest_version: 3,
911
// In UTC time: YYYY.MMDD.HHMM.SSmmm
10-
version: `${new Date().getUTCFullYear()}.${new Date().getUTCMonth() + 1}${String(new Date().getUTCDate()).padStart(2, "0")}.${new Date().getUTCMinutes()}${String(new Date().getUTCHours()).padStart(2, "0")}.${new Date().getUTCSeconds()}${String(new Date().getUTCMilliseconds()).padStart(3, "0")}`,
12+
version: realVersion,
1113
// semver is OK in "version_name"
12-
version_name: version,
14+
version_name: version + (process.argv[4] === "production" ? "" : ` Dev Build ${realVersion}`),
1315
"name": "SAS Powerschool Enhancement Suite",
1416
"description": "Provides various enhancements for SAS Powerschool",
1517
"action": {
@@ -27,8 +29,21 @@ export default defineManifest(async (env) => ({
2729
{
2830
"matches": ["https://powerschool.sas.edu.sg/public/*"],
2931
"js": ["src/content_script/home/index.ts"]
32+
},
33+
{
34+
"matches": [
35+
"https://powerschool.sas.edu.sg/guardian/home.html*"
36+
],
37+
"js": ["src/content_script/guardianHome/index.ts"]
3038
}
3139
],
40+
"options_ui": {
41+
"page": "src/options/index.html",
42+
"open_in_tab": false
43+
},
44+
"icons": {
45+
"128": "public/icon.png"
46+
},
3247
"permissions": ["storage"],
3348
"web_accessible_resources": [
3449
{

package-lock.json

Lines changed: 54 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"type": "module",
77
"scripts": {
88
"dev": "vite",
9-
"build": "vite build",
9+
"build:dev": "vite build ./ development; echo 'Development build done.';",
10+
"build:prod": "vite build ./ production; echo 'Production build done.';",
1011
"preview": "vite preview",
1112
"check": "svelte-check --tsconfig ./tsconfig.json",
1213
"format": "prettier --write ."
@@ -20,6 +21,7 @@
2021
"@types/webextension-polyfill": "^0.10.7",
2122
"@typescript-eslint/eslint-plugin": "^6.16.0",
2223
"autoprefixer": "^10.4.16",
24+
"dotenv": "^16.3.1",
2325
"postcss": "^8.4.32",
2426
"prettier": "^3.1.1",
2527
"prettier-plugin-svelte": "^3.1.2",
@@ -31,6 +33,7 @@
3133
},
3234
"dependencies": {
3335
"@sveltejs/vite-plugin-svelte": "^2.5.3",
36+
"shepherd.js": "^11.2.0",
3437
"vite": "^4.5.1",
3538
"webextension-polyfill": "^0.10.0"
3639
}

src/app.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,7 @@
1616
#score-tools p {
1717
padding: 0;
1818
margin: 0;
19+
}
20+
.current-step {
21+
@apply tw-outline tw-outline-offset-2 tw-outline-yellow-500;
1922
}

src/content_script/def/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
*
3-
* @copyright Copyright (c) 2023 Anvay Mathur <[email protected]>
3+
* @copyright Copyright (c) 2023-2024 Anvay Mathur <[email protected]>
44
*
55
* @author Anvay Mathur <[email protected]>
66
*
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
<script lang="ts">
2+
import { gradeToPercent, listOfGrades } from "../..//models/grades";
3+
import type { ClassManager } from "../../models/classes";
4+
5+
export let classManager: ClassManager;
6+
7+
$: sem1GPA = classManager.calculateGPA(1);
8+
$: sem2GPA = classManager.calculateGPA(2);
9+
10+
let editGrades = false;
11+
let hideGPA = true;
12+
</script>
13+
14+
<label class="tw-flex tw-items-center tw-gap-2 tw-mb-2">
15+
<input type="checkbox" class="!tw-m-0" bind:checked={hideGPA} />
16+
Hide GPA
17+
</label>
18+
19+
{#if !hideGPA}
20+
<p class="tw-font-bold">Do not rely on any data from SAS PES!!</p>
21+
{#if sem1GPA && sem1GPA !== -1}
22+
<p>First Semester GPA: {classManager.calculateGPA(1).toFixed(2)}</p>
23+
{:else}
24+
<p>First Semester GPA: N/A</p>
25+
{/if}
26+
27+
{#if sem2GPA && sem2GPA !== -1}
28+
<p>Second Semester GPA: {classManager.calculateGPA(2).toFixed(2)}</p>
29+
{:else}
30+
<p>Second Semester GPA: N/A</p>
31+
{/if}
32+
33+
<label class="tw-flex tw-items-center tw-gap-2 tw-mb-2">
34+
<input type="checkbox" class="!tw-m-0" bind:checked={editGrades} />
35+
Edit grades for GPA calculation
36+
</label>
37+
38+
{#if editGrades}
39+
<p class="tw-mb-2">
40+
Note: Semester classes count as 1 credit for GPA calculation.
41+
</p>
42+
<table class="!tw-w-auto grid zebra tw-mb-4">
43+
<thead>
44+
<th> Class </th>
45+
<th> S1 Grade </th>
46+
<th> S2 Grade </th>
47+
<th> Credits </th>
48+
<th> AP/AT </th>
49+
</thead>
50+
<tbody>
51+
{#each classManager.classes as c, i}
52+
<tr>
53+
<td> {c.name} </td>
54+
<td>
55+
<select
56+
class="tw-rounded-md tw-h-full tw-border-[#CCCCCC] tw-border-solid tw-border tw-p-1"
57+
bind:value={classManager.classes[i].grade.s1}
58+
>
59+
{#each listOfGrades as grade}
60+
<option value={grade}
61+
>{grade}
62+
{grade !== "INC" ? `(${gradeToPercent[grade]}%)` : ""}
63+
</option>
64+
{/each}
65+
</select>
66+
</td>
67+
<td>
68+
<select
69+
class="tw-rounded-md tw-h-full tw-border-[#CCCCCC] tw-border-solid tw-border tw-p-1"
70+
bind:value={classManager.classes[i].grade.s2}
71+
>
72+
{#each listOfGrades as grade}
73+
<option value={grade}
74+
>{grade}
75+
{grade !== "INC" ? `(${gradeToPercent[grade]}%)` : ""}
76+
</option>
77+
{/each}
78+
<option value={null}>No grade</option>
79+
</select>
80+
</td>
81+
<td>
82+
<select
83+
class="tw-rounded-md tw-h-full tw-border-[#CCCCCC] tw-border-solid tw-border tw-p-1"
84+
bind:value={classManager.classes[i].credits}
85+
>
86+
<option value={0}>0</option>
87+
<option value={0.5}>0.5</option>
88+
<option value={1}>1</option>
89+
<option value={2}>2</option>
90+
</select>
91+
</td>
92+
<td class="tw-align-middle tw-text-center">
93+
<input
94+
type="checkbox"
95+
class="!tw-m-0"
96+
bind:checked={classManager.classes[i].isBoosted}
97+
/>
98+
</td>
99+
</tr>
100+
{/each}
101+
</tbody>
102+
</table>
103+
{/if}
104+
{/if}

0 commit comments

Comments
 (0)