Skip to content

Commit 6b68267

Browse files
authored
πŸ›«πŸ§¬ ↝ [CPW-2 CPW-8 SGV2-141]: Merge pull request #132 from Signal-K/CPW-8
πŸͺ΄πŸ›« ↝ [CPW-2 CPW-8 SGV2-141]: Post cards + APPEEARS api classifications
2 parents d9d9e0b + b3473ec commit 6b68267

File tree

450 files changed

+33983
-6242
lines changed

Some content is hidden

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

450 files changed

+33983
-6242
lines changed

β€Ž.DS_Store

0 Bytes
Binary file not shown.
+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
# The branches below must be a subset of the branches above
8+
branches: [main]
9+
schedule:
10+
- cron: '0 21 * * 0'
11+
12+
jobs:
13+
analyze:
14+
name: Analyze
15+
runs-on: ubuntu-latest
16+
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
# Override automatic language detection by changing the below list
21+
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
22+
language: ['javascript']
23+
# Learn more...
24+
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
25+
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v2
29+
with:
30+
# We must fetch at least the immediate parents so that if this is
31+
# a pull request then we can checkout the head.
32+
fetch-depth: 2
33+
34+
# If this run was triggered by a pull request event, then checkout
35+
# the head of the pull request instead of the merge commit.
36+
- run: git checkout HEAD^2
37+
if: ${{ github.event_name == 'pull_request' }}
38+
39+
# Initializes the CodeQL tools for scanning.
40+
- name: Initialize CodeQL
41+
uses: github/codeql-action/init@v1
42+
with:
43+
languages: ${{ matrix.language }}
44+
# If you wish to specify custom queries, you can do so here or in a config file.
45+
# By default, queries listed here will override any specified in a config file.
46+
# Prefix the list here with "+" to use these queries and those in the config file.
47+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
48+
49+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
50+
# If this step fails, then you should remove it and run the build manually (see below)
51+
- name: Autobuild
52+
uses: github/codeql-action/autobuild@v1
53+
54+
# ℹ️ Command-line programs to run using the OS shell.
55+
# πŸ“š https://git.io/JvXDl
56+
57+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
58+
# and modify them (or add more) to build your code if your project
59+
# uses a compiled language
60+
61+
#- run: |
62+
# make bootstrap
63+
# make release
64+
65+
- name: Perform CodeQL Analysis
66+
uses: github/codeql-action/analyze@v1

β€Ž.github/workflows/deta.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Push to Space
2+
on: push
3+
4+
jobs:
5+
push-to-space:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v3
9+
- name: Deta Space Deployment Github Action
10+
uses: neobrains/space-deployment-github-action@v0.5
11+
with:
12+
access_token: ${{ secrets.ACCESS_TOKEN }}
13+
project_id: ${{ secrets.PROJECT_ID }}
14+
space_push: true
15+
list_on_discovery: true

β€Ž.gitmodules

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
[submodule "api"]
2-
path = api
1+
[submodule "app"]
2+
path = app
33
url = https://github.com/signal-k/sytizen
4-
branch = wb3-14--generate-asset-id-statselements-for-container
4+
branch = wb3-14--generate-asset-id-statselements-for-container
5+
6+
# should be api, not app

β€Ž.vscode/settings.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"jira-plugin.workingProject": "",
33
"liveServer.settings.port": 5501,
4-
"solidity.defaultCompiler": "localFile",
5-
"solidity.compileUsingRemoteVersion": "v0.8.11+commit.d7f03943"
4+
"solidity.compileUsingRemoteVersion": "v0.8.11+commit.d7f03943",
5+
"solidity.defaultCompiler": "localFile"
66
}

β€ŽSpacefile

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Spacefile Docs: https://go.deta.dev/docs/spacefile/v0
2+
v: 0
3+
micros:
4+
- name: client
5+
src: ./
6+
engine: next
7+
primary: true

β€Žapi

-1
This file was deleted.

β€Žapp

Submodule app added at 804d848

β€Žcomponents/AccountAvatar.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default function AccountAvatar ({
3333
};
3434
const url = URL.createObjectURL(data);
3535
setAvatarUrl(url);
36-
} catch (error) {
36+
} catch (error) {
3737
console.log('Error downloading image: ', error)
3838
}
3939
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
import React, { useEffect, useState } from "react";
2+
import { useSession, useSupabaseClient } from "@supabase/auth-helpers-react";
3+
import { Container, Row, ButtonGroup, ToggleButton } from "react-bootstrap";
4+
5+
import Login from "../../../pages/login";
6+
import PlanetGalleryCard from "../../Gameplay/Planets/PlanetGalleryCard";
7+
import DashboardLayout from "../../Tests/Layout/Dashboard";
8+
9+
export default function PlanetStatusGalleryIndex() {
10+
const supabase = useSupabaseClient();
11+
const session = useSession();
12+
const [planets, setPlanets] = useState([]);
13+
const [selectedClassificationStatus, setSelectedClassificationStatus] =
14+
useState<string | null>("incomplete");
15+
16+
useEffect(() => {
17+
getPlanets();
18+
}, [session, selectedClassificationStatus]);
19+
20+
const getPlanets = async () => {
21+
try {
22+
let query = supabase
23+
.from("planetsss")
24+
.select("*")
25+
.order("created_at", { ascending: false })
26+
.limit(20)
27+
.gte("id", 45)
28+
.lt("id", 102);
29+
30+
if (selectedClassificationStatus !== null) {
31+
query = query.eq("classification_status", selectedClassificationStatus);
32+
} else {
33+
query = query.is("classification_status", null); // Filter planets with no classification_status
34+
}
35+
36+
const { data, error } = await query;
37+
38+
// if (data != null) {
39+
// setPlanets(data);
40+
// }
41+
42+
if (error) {
43+
throw error;
44+
}
45+
} catch (error: any) {
46+
alert(error.message);
47+
}
48+
};
49+
50+
const classificationStatusOptions = [
51+
{ value: "incomplete", label: "Incomplete" },
52+
{ value: "in progress", label: "In Progress" },
53+
{ value: "completed", label: "Completed" },
54+
];
55+
56+
const buttonStyle = {
57+
backgroundColor: "rgba(255, 255, 255, 0.2)",
58+
border: "none",
59+
color: "black",
60+
transition: "background-color 0.3s ease",
61+
cursor: "pointer",
62+
marginRight: "8px",
63+
};
64+
65+
const activeButtonStyle = {
66+
backgroundColor: "rgba(255, 255, 255, 0.3)",
67+
};
68+
69+
if (!session) {
70+
return <Login />;
71+
}
72+
73+
return (
74+
<DashboardLayout>
75+
<Container>
76+
<ButtonGroup className="mb-3">
77+
{classificationStatusOptions.map((option) => (
78+
<ToggleButton
79+
key={option.value}
80+
type="radio"
81+
variant="outline-secondary"
82+
name="classification_status"
83+
value={option.value}
84+
checked={selectedClassificationStatus === option.value}
85+
onChange={() => setSelectedClassificationStatus(option.value)}
86+
style={
87+
selectedClassificationStatus === option.value
88+
? { ...buttonStyle, ...activeButtonStyle }
89+
: buttonStyle
90+
}
91+
>
92+
{option.label}
93+
</ToggleButton>
94+
))}
95+
</ButtonGroup>
96+
<Row>
97+
{/* {planets.map((planet) => (
98+
<PlanetGalleryCard key={planet.id} planet={planet} />
99+
))} */}
100+
<p>Test</p>
101+
</Row>
102+
</Container>
103+
</DashboardLayout>
104+
);
105+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import React, { useEffect, useState } from "react";
2+
import axios from "axios";
3+
import { useSupabaseClient, useSession } from "@supabase/auth-helpers-react";
4+
import Login from "../../../pages/login";
5+
6+
interface Planet {
7+
id: number;
8+
content: string;
9+
}
10+
11+
const AdminPlanetStatusUpdater: React.FC = () => {
12+
const supabase = useSupabaseClient();
13+
const session = useSession();
14+
15+
if (!session) {
16+
return (
17+
<Login />
18+
)
19+
}
20+
21+
const [planets, setPlanets] = useState<Planet[]>([]);
22+
useEffect(() => {
23+
fetchPlanets();
24+
}, []);
25+
26+
const fetchPlanets = async () => {
27+
try {
28+
const { data, error } = await supabase
29+
.from('planetsss')
30+
.select('id, content')
31+
if (error) {
32+
console.error('Error fetching planets: ', error)
33+
} else {
34+
setPlanets(data);
35+
}
36+
} catch (error) {
37+
console.error('Error fetching planets: ', error);
38+
};
39+
};
40+
41+
const updatePlanetStatus = async (planetId: number) => {
42+
try {
43+
const { error } = await supabase.from('planet_status').upsert({
44+
planet_id: planetId,
45+
status: 'in progress',
46+
updated_by: ''
47+
});
48+
if (error) {
49+
console.error('Error updating planet status: ', error);
50+
} else { console.log('Planet status updated successfully'); };
51+
} catch (error) {
52+
console.error('Error updating planet status:', error);
53+
}
54+
};
55+
56+
return (
57+
<div>
58+
<h2 className="text-xl font-bold text-gray-800">Admin component</h2>
59+
{planets.map((planet) => (
60+
<div key={planet.id}>
61+
<p>{planet.content}</p>
62+
<button onClick={() => updatePlanetStatus(planet.id)}>Update status</button>
63+
</div>
64+
))};
65+
</div>
66+
);
67+
};
68+
69+
export default AdminPlanetStatusUpdater;

0 commit comments

Comments
Β (0)