Skip to content

Commit

Permalink
πŸ›«πŸ§¬ ↝ [CPW-2 CPW-8 SGV2-141]: Merge pull request #132 from Signal-K/CPW-8
Browse files Browse the repository at this point in the history
πŸͺ΄πŸ›« ↝ [CPW-2 CPW-8 SGV2-141]: Post cards + APPEEARS api classifications
  • Loading branch information
Gizmotronn authored Aug 19, 2024
2 parents d9d9e0b + b3473ec commit 6b68267
Show file tree
Hide file tree
Showing 450 changed files with 33,983 additions and 6,242 deletions.
Binary file modified .DS_Store
Binary file not shown.
66 changes: 66 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: "CodeQL"

on:
push:
branches: [main]
pull_request:
# The branches below must be a subset of the branches above
branches: [main]
schedule:
- cron: '0 21 * * 0'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
# Override automatic language detection by changing the below list
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
language: ['javascript']
# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2

# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# πŸ“š https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
15 changes: 15 additions & 0 deletions .github/workflows/deta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Push to Space
on: push

jobs:
push-to-space:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Deta Space Deployment Github Action
uses: neobrains/[email protected]
with:
access_token: ${{ secrets.ACCESS_TOKEN }}
project_id: ${{ secrets.PROJECT_ID }}
space_push: true
list_on_discovery: true
8 changes: 5 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[submodule "api"]
path = api
[submodule "app"]
path = app
url = https://github.com/signal-k/sytizen
branch = wb3-14--generate-asset-id-statselements-for-container
branch = wb3-14--generate-asset-id-statselements-for-container

# should be api, not app
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"jira-plugin.workingProject": "",
"liveServer.settings.port": 5501,
"solidity.defaultCompiler": "localFile",
"solidity.compileUsingRemoteVersion": "v0.8.11+commit.d7f03943"
"solidity.compileUsingRemoteVersion": "v0.8.11+commit.d7f03943",
"solidity.defaultCompiler": "localFile"
}
7 changes: 7 additions & 0 deletions Spacefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Spacefile Docs: https://go.deta.dev/docs/spacefile/v0
v: 0
micros:
- name: client
src: ./
engine: next
primary: true
1 change: 0 additions & 1 deletion api
Submodule api deleted from 8f4235
1 change: 1 addition & 0 deletions app
Submodule app added at 804d84
2 changes: 1 addition & 1 deletion components/AccountAvatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default function AccountAvatar ({
};
const url = URL.createObjectURL(data);
setAvatarUrl(url);
} catch (error) {
} catch (error) {
console.log('Error downloading image: ', error)
}
}
Expand Down
105 changes: 105 additions & 0 deletions components/Backend/Admin/PlanetStatusGalleryIndex.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
import React, { useEffect, useState } from "react";
import { useSession, useSupabaseClient } from "@supabase/auth-helpers-react";
import { Container, Row, ButtonGroup, ToggleButton } from "react-bootstrap";

import Login from "../../../pages/login";
import PlanetGalleryCard from "../../Gameplay/Planets/PlanetGalleryCard";
import DashboardLayout from "../../Tests/Layout/Dashboard";

export default function PlanetStatusGalleryIndex() {
const supabase = useSupabaseClient();
const session = useSession();
const [planets, setPlanets] = useState([]);
const [selectedClassificationStatus, setSelectedClassificationStatus] =
useState<string | null>("incomplete");

useEffect(() => {
getPlanets();
}, [session, selectedClassificationStatus]);

const getPlanets = async () => {
try {
let query = supabase
.from("planetsss")
.select("*")
.order("created_at", { ascending: false })
.limit(20)
.gte("id", 45)
.lt("id", 102);

if (selectedClassificationStatus !== null) {
query = query.eq("classification_status", selectedClassificationStatus);
} else {
query = query.is("classification_status", null); // Filter planets with no classification_status
}

const { data, error } = await query;

// if (data != null) {
// setPlanets(data);
// }

if (error) {
throw error;
}
} catch (error: any) {
alert(error.message);
}
};

const classificationStatusOptions = [
{ value: "incomplete", label: "Incomplete" },
{ value: "in progress", label: "In Progress" },
{ value: "completed", label: "Completed" },
];

const buttonStyle = {
backgroundColor: "rgba(255, 255, 255, 0.2)",
border: "none",
color: "black",
transition: "background-color 0.3s ease",
cursor: "pointer",
marginRight: "8px",
};

const activeButtonStyle = {
backgroundColor: "rgba(255, 255, 255, 0.3)",
};

if (!session) {
return <Login />;
}

return (
<DashboardLayout>
<Container>
<ButtonGroup className="mb-3">
{classificationStatusOptions.map((option) => (
<ToggleButton
key={option.value}
type="radio"
variant="outline-secondary"
name="classification_status"
value={option.value}
checked={selectedClassificationStatus === option.value}
onChange={() => setSelectedClassificationStatus(option.value)}
style={
selectedClassificationStatus === option.value
? { ...buttonStyle, ...activeButtonStyle }
: buttonStyle
}
>
{option.label}
</ToggleButton>
))}
</ButtonGroup>
<Row>
{/* {planets.map((planet) => (
<PlanetGalleryCard key={planet.id} planet={planet} />
))} */}
<p>Test</p>
</Row>
</Container>
</DashboardLayout>
);
}
69 changes: 69 additions & 0 deletions components/Backend/Admin/PlanetStatusMasterControls.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import React, { useEffect, useState } from "react";
import axios from "axios";
import { useSupabaseClient, useSession } from "@supabase/auth-helpers-react";
import Login from "../../../pages/login";

interface Planet {
id: number;
content: string;
}

const AdminPlanetStatusUpdater: React.FC = () => {
const supabase = useSupabaseClient();
const session = useSession();

if (!session) {
return (
<Login />
)
}

const [planets, setPlanets] = useState<Planet[]>([]);
useEffect(() => {
fetchPlanets();
}, []);

const fetchPlanets = async () => {
try {
const { data, error } = await supabase
.from('planetsss')
.select('id, content')
if (error) {
console.error('Error fetching planets: ', error)
} else {
setPlanets(data);
}
} catch (error) {
console.error('Error fetching planets: ', error);
};
};

const updatePlanetStatus = async (planetId: number) => {
try {
const { error } = await supabase.from('planet_status').upsert({
planet_id: planetId,
status: 'in progress',
updated_by: ''
});
if (error) {
console.error('Error updating planet status: ', error);
} else { console.log('Planet status updated successfully'); };
} catch (error) {
console.error('Error updating planet status:', error);
}
};

return (
<div>
<h2 className="text-xl font-bold text-gray-800">Admin component</h2>
{planets.map((planet) => (
<div key={planet.id}>
<p>{planet.content}</p>
<button onClick={() => updatePlanetStatus(planet.id)}>Update status</button>
</div>
))};
</div>
);
};

export default AdminPlanetStatusUpdater;
Loading

0 comments on commit 6b68267

Please sign in to comment.