Skip to content

Commit

Permalink
Merge pull request #606 from IntersectMBO/develop
Browse files Browse the repository at this point in the history
Enhancements and Fixes: Voting Context Update, Metadata Management, Backend Workflow Improvements
  • Loading branch information
pmbinapps authored Apr 2, 2024
2 parents 82871e7 + ae71275 commit 32099d9
Show file tree
Hide file tree
Showing 92 changed files with 7,245 additions and 569 deletions.
1 change: 0 additions & 1 deletion .github/workflows/code_check_backend.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: Backend Lint & Format Check
description: 'Check Haskell code in backend module'

on:
workflow_dispatch:
Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ changes.

## [Unreleased]

- Check a GA metadata is valid [Issue 535](https://github.com/IntersectMBO/govtool/issues/535)
- DRep metadata builder [Issue 497](https://github.com/IntersectMBO/govtool/issues/497)
- Update Cardano Serialization Lib to 12.0.0-alpha.19 [Issue 521](https://github.com/IntersectMBO/govtool/issues/521)
- Add generate jsonld function [Issue 451](https://github.com/IntersectMBO/govtool/issues/451)
Expand All @@ -28,6 +29,7 @@ changes.
- Fix all the existing typescript errors [Issue 514](https://github.com/IntersectMBO/govtool/issues/514)
- Fix endless spinner on a dashboard [Issue 539](https://github.com/IntersectMBO/govtool/issues/539)
- Update frontend package readme to reflect recent changes [Issue 543](https://github.com/IntersectMBO/govtool/issues/543)
- Change input selection strategy to 3 (random) [Issue 575](https://github.com/IntersectMBO/govtool/issues/575)

### Added

Expand Down Expand Up @@ -65,7 +67,7 @@ changes.
### Changed

- `proposal/list` returns additional data such ass `expiryEpochNo`, `createdEpochNo`, `title`, `about`, `motivation`,
`rationale`. `TreasuryWithdrawals` GAs also got nicely formated details. [Issue 372](https://github.com/IntersectMBO/govtool/issues/372)
`rationale`. `TreasuryWithdrawals` GAs also got nicely formated details. [Issue 372](https://github.com/IntersectMBO/govtool/issues/372)
- `drep/list` now return also `status` and `type` fields. Also it now returns the retired dreps, and you can search for given drep by name using optional query parameter. If the drep name is passed exactly, then you can even find a drep that's sole voter. [Issue 446](https://github.com/IntersectMBO/govtool/issues/446)
- `drep/list` and `drep/info` endpoints now return additional data such as metadata url and hash, and voting power [Issue 223](https://github.com/IntersectMBO/govtool/issues/223)
- `drep/info` now does not return sole voters (dreps without metadata) [Issue 317](https://github.com/IntersectMBO/govtool/issues/317)
Expand Down
22 changes: 11 additions & 11 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# GovTool Project Codeowners

# These owners will be the default owners for everything in the repository.
* @kickloop @MSzalowski
* @Ryun1 @MSzalowski

# Frontend assets templates
govtool/frontend/* @MSzalowski @Sworzen1 @JanJaroszczak @kickloop
*.tsx @MSzalowski @Sworzen1 @JanJaroszczak @kickloop
*.ts @MSzalowski @Sworzen1 @JanJaroszczak @kickloop
*.css @MSzalowski @Sworzen1 @JanJaroszczak @kickloop
govtool/frontend/* @MSzalowski @Sworzen1 @JanJaroszczak
*.tsx @MSzalowski @Sworzen1 @JanJaroszczak
*.ts @MSzalowski @Sworzen1 @JanJaroszczak
*.css @MSzalowski @Sworzen1 @JanJaroszczak

# Backend
govtool/backend/* @MSzalowski @jankun4 @kickloop
govtool/backend/* @MSzalowski @jankun4

# DevOps
.github/workflows/* @placek @adgud @kickloop
config/govtool/* @placek @adgud @kickloop
infra/terraform/* @placek @adgud @kickloop
.github/workflows/* @placek @adgud
config/govtool/* @placek @adgud
infra/terraform/* @placek @adgud

# Testing
gov-action-loader/* @IntersectMBO/govtool-test @kickloop
tests/* @IntersectMBO/govtool-test @kickloop
tests/* @IntersectMBO/govtool-test
gov-action-loader/* @IntersectMBO/govtool-test
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,43 @@
<hr/>

## 🌄 Purpose

The SanchoNet GovTool enables ada holders to experience some of the governance features described in [CIP-1694](https://github.com/cardano-foundation/CIPs/blob/master/CIP-1694/README.md) and to test governance features on [SanchoNet](https://sancho.network/) through a guided and straightforward experience.
The SanchoNet GovTool is currently open for beta testing and can be accessed at [sanchogov.tools](https://sanchogov.tools/).

Learn more; [docs.sanchogov.tools](https://docs.sanchogov.tools/).

## 📍 Navigation

- [GovTool Backend](./govtool/backend/README.md)
- [GovTool Frontend](./govtool/frontend/README.md)
- [GovTool deployment setup](./scripts/govtool/README.md)
- [Documentation](./docs/)
- [Tests](./tests/)

### Utilities

- [Governance Action Loader](./src/governance-action-loader/)

## 🔩 Architecture

GovTool consists of a Haskell backend and a React Typescript frontend.

### Backend

GovTool backend implements an API wrapper around an instance of [DB-Sync](https://github.com/IntersectMBO/cardano-db-sync) which interfaces with a [Cardano Node](https://github.com/IntersectMBO/cardano-node).
The API exposes endpoints making the querying of governance related data from DB-Sync straight forward.

#### API Reference
[`Swagger documentation`]()

[`Swagger documentation`](https://sanchogov.tools/api/swagger-ui/)

### Frontend

GovTool frontend web app communicates with the backend over a REST interface, reading and displaying on-chain governance data.
Frontend is able to connect to Cardano wallets over the [CIP-30](https://github.com/cardano-foundation/CIPs/blob/master/CIP-0030/README.md) and [CIP-95](https://github.com/cardano-foundation/CIPs/blob/master/CIP-0095/README.md) standards.

## 🤝 Contributing

Thanks for considering contributing and helping us on creating GovTool! 😎
Please checkout our [Contributing Documentation](./CONTRIBUTING.md).
4 changes: 2 additions & 2 deletions govtool/frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
RegisterAsSoleVoter,
RetireAsDrep,
RetireAsSoleVoter,
UpdatedRepMetadata,
EditDRepMetadata,
} from "@pages";
import { SetupInterceptors } from "@services";
import {
Expand Down Expand Up @@ -118,7 +118,7 @@ export default () => {
/>
<Route path={PATHS.retireAsSoleVoter} element={<RetireAsSoleVoter />} />
<Route path={PATHS.stakeKeys} element={<ChooseStakeKey />} />
<Route path={PATHS.updateMetadata} element={<UpdatedRepMetadata />} />
<Route path={PATHS.editDrepMetadata} element={<EditDRepMetadata />} />
<Route path="*" element={<ErrorPage />} />
<Route path={PATHS.error} element={<ErrorPage />} />
</Routes>
Expand Down
5 changes: 2 additions & 3 deletions govtool/frontend/src/components/molecules/Breadcrumbs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { NavLink, To } from "react-router-dom";
import { Box } from "@mui/material";
import Divider from "@mui/material/Divider";

import { useScreenDimension, useTranslation } from "@hooks";
import { useScreenDimension } from "@hooks";
import { Typography } from "@atoms";

type BreadcrumbsProps = {
Expand All @@ -18,7 +18,6 @@ export const Breadcrumbs = ({
elementTwo,
isDataMissing,
}: BreadcrumbsProps) => {
const { t } = useTranslation();
const { isMobile } = useScreenDimension();

return (
Expand Down Expand Up @@ -55,7 +54,7 @@ export const Breadcrumbs = ({
textOverflow: "ellipsis",
}}
>
{isDataMissing ? t("govActions.dataMissing") : elementTwo}
{isDataMissing || elementTwo}
</Typography>
</Box>
);
Expand Down
50 changes: 37 additions & 13 deletions govtool/frontend/src/components/molecules/DataMissingInfoBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,42 @@ import { Box, Link } from "@mui/material";

import { Typography } from "@atoms";
import { useTranslation } from "@hooks";
import { openInNewTab } from "@utils";
import { GAMetedataErrors, openInNewTab } from "@utils";

export const DataMissingInfoBox = () => {
export const DataMissingInfoBox = ({
isDataMissing,
isInProgress,
isSubmitted,
}: {
isDataMissing: boolean | GAMetedataErrors;
isInProgress?: boolean;
isSubmitted?: boolean;
}) => {
const { t } = useTranslation();

return (
const gaMetadataErrorMessage = {
[GAMetedataErrors.DATA_MISSING]: t("errors.gAMetadata.message.dataMissing"),
[GAMetedataErrors.INCORRECT_FORMAT]: t(
"errors.gAMetadata.message.incorrectFormat",
),
[GAMetedataErrors.NOT_VERIFIABLE]: t(
"errors.gAMetadata.message.notVerifiable",
),
}[isDataMissing as GAMetedataErrors];

const gaMetadataErrorDescription = {
[GAMetedataErrors.DATA_MISSING]: t(
"errors.gAMetadata.description.dataMissing",
),
[GAMetedataErrors.INCORRECT_FORMAT]: t(
"errors.gAMetadata.description.incorrectFormat",
),
[GAMetedataErrors.NOT_VERIFIABLE]: t(
"errors.gAMetadata.description.notVerifiable",
),
}[isDataMissing as GAMetedataErrors];

return isDataMissing && !isSubmitted && !isInProgress ? (
<Box
sx={{
mb: 4,
Expand All @@ -22,9 +52,7 @@ export const DataMissingInfoBox = () => {
mb: 0.5,
}}
>
{/* TODO: Text to confirm/change */}
The data that was originally used when this Governance Action was
created has been formatted incorrectly.
{gaMetadataErrorMessage}
</Typography>
<Typography
sx={{
Expand All @@ -33,17 +61,13 @@ export const DataMissingInfoBox = () => {
mb: 0.5,
}}
>
{/* TODO: Text to confirm/change */}
GovTool uses external sources for Governance Action data, and these
sources are maintained by the proposers of the Actions. This error means
that GovTool cannot locate the data on the URL specified when the
Governance Action was originally posted.
{gaMetadataErrorDescription}
</Typography>
<Link
onClick={() =>
// TODO: Add the correct link
openInNewTab(
"https://docs.sanchogov.tools/how-to-use-the-govtool/getting-started/get-a-compatible-wallet"
"https://docs.sanchogov.tools/how-to-use-the-govtool/getting-started/get-a-compatible-wallet",
)
}
sx={{
Expand All @@ -56,5 +80,5 @@ export const DataMissingInfoBox = () => {
{t("learnMore")}
</Link>
</Box>
);
) : null;
};
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@ import {
getProposalTypeNoEmptySpaces,
} from "@utils";

const mockedLongText =
"Lorem ipsum dolor sit, amet consectetur adipisicing elit. Sit, distinctio culpa minus eaque illo quidem voluptates quisquam mollitia consequuntur ex, sequi saepe? Ad ex adipisci molestiae sed.";

type ActionTypeProps = Omit<
ActionType,
ActionTypeToDsiplay,
| "yesVotes"
| "noVotes"
| "abstainVotes"
Expand All @@ -32,7 +29,6 @@ type ActionTypeProps = Omit<
| "rationale"
| "motivation"
> & {
isDataMissing: boolean;
onClick?: () => void;
inProgress?: boolean;
};
Expand Down Expand Up @@ -87,14 +83,12 @@ export const GovernanceActionCard: FC<ActionTypeProps> = ({ ...props }) => {
}}
>
<GovernanceActionCardHeader
// TODO: Remove "Fund our project" when title is implemented everywhere
title={title ?? "Fund our project"}
title={title}
isDataMissing={isDataMissing}
/>
<GovernanceActionCardElement
label={t("govActions.abstract")}
// TODO: Remove mock when possible
text={about ?? mockedLongText}
text={about}
textVariant="twoLines"
dataTestId="governance-action-abstract"
isSliderCard
Expand Down
Loading

0 comments on commit 32099d9

Please sign in to comment.