Giter Site home page Giter Site logo

condorcet-frontend's Introduction

Condorcet Frontend

Todo list

  • password reset
  • redirect to login page on expired token
    • go back to original page after login
  • archive election results
    • preserve information so that it does not get lost when deleting election or user
  • delete election/user
    • depends on archiving elections
  • confirmations for destructive operations
  • changes after vote
    • for some kinds of elections it makes sense to allow changes to the election after voting has started
    • still need to preserve the kinds of elections where everything is fixed once voting starts

Prerequisites

Make sure condorcet-backend is running

Scripts

  • ./scripts/prepare.sh
    • One time initialization
  • ./scripts/run.sh
    • Run application
  • ./scripts/test.sh
    • Run the tests
  • ./scripts/coverage.sh
    • Test coverage report

How this project was created

npm install -g npm@latest
npx create-react-app condorcet-frontend
cd condorcet-frontend
npm install ramda
npm install redux
npm install react-redux
npm install redux-saga
npm install history
npm install http-proxy-middleware

Proxy setup

Create file src/setupProxy.js, with the following contents

const {createProxyMiddleware} = require('http-proxy-middleware');

module.exports = function (app) {
    const options = {
        target: 'http://localhost:8080',
        changeOrigin: true,
        pathRewrite: {
            '^/proxy/': '/',
        }
    };
    app.use(
        '/proxy/',
        createProxyMiddleware(options)
    );
};

The idea here is to be specific about which http paths should render something from the source directory vs. a proxy to elsewhere. This helps prevent urls from conflicting in case a path to a proxied resource happens to match a path to a resource in the src directory. The source code adds the 'proxy' prefix indicating this is a request that should be proxied, but when proxying out externally, the proxy middleware rewrites the url, removing the proxy prefix.

Css reset

Add the file reset.css, and import it from index.js import './reset.css'

The idea here is to preserve a consistent presentation in spite of different browser css defaults, and be more explicit and intentional about what css styles are applied

Technology Stack

Nginx

config file is at /usr/local/etc/nginx/nginx.conf

html content symlink is at /usr/local/Cellar/nginx/1.21.6/html html content is at /usr/local/var/www

to stop nginx nginx -s quit

Confirmed to work

location  /proxy {
    rewrite /proxy/(.*) /$1 break;
    proxy_pass         http://localhost:8080;
    proxy_redirect     off;
    proxy_set_header   Host $host;
}

Notes

To pull out emails from table Array.from(document.querySelectorAll('td:nth-child(3)')).map(element => element.innerText).forEach(email => console.log(email))

condorcet-frontend's People

Contributors

seanshubin avatar

Watchers

James Cloos avatar

condorcet-frontend's Issues

Redirect to login/signup

When you go directly to an election, you should be redirected to login if you aren't currently

Bug: Token expired

When trying to cast a ballot. There are a lot of issues with token expiration.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.