remove github authentication. Documentation is now public

Signed-off-by: jffarge <jf@dagger.io>
This commit is contained in:
jffarge
2022-03-29 13:28:45 +02:00
parent ea59c932bb
commit fb10328a2b
9 changed files with 5 additions and 237 deletions

View File

@@ -1,15 +0,0 @@
import React from "react";
import { GithubLoginButton } from 'react-social-login-buttons';
import style from './DocPageAuthentication.module.css'
export default function DocAuthentication() {
return (
<div data-cy="cy-signin" className={style.container}>
<h1 className={style.h1}>Welcome to the Dagger documentation</h1>
<p>Please Sign In to Github to get access to the doc</p>
<div data-cy="cy-btn-signin">
<GithubLoginButton className={style.btn__github} onClick={() => window.location.href = process.env.REACT_APP_GITHUB_AUTHORIZE_URI} />
</div>
</div>
)
}

View File

@@ -1,18 +0,0 @@
.container {
background: url("/img/Dagger_Website_Space_Uranus.png") no-repeat;
background-size: cover;
height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.btn__github {
width: 240px !important;
border-radius: 0 !important;
}
.btn__github > div {
display: inline-flex !important;
}

View File

@@ -1,39 +0,0 @@
import React, { useState, useEffect } from 'react';
import qs from 'querystringify';
import isEmpty from 'lodash/isEmpty';
import NProgress from "nprogress";
import { checkUserCollaboratorStatus } from '../api/github'
import DocPageAuthentication from './DocPageAuthentication';
import DocPageRedirect from './DocPageRedirect';
function DocPageCustom({ location, userAccessStatus, setUserAccessStatus }) {
const [isLoading, setIsLoading] = useState(true)
const [redirectState, setRedirectState] = useState()
const authQuery = qs.parse(location.search);
useEffect(async () => {
NProgress.start()
if (!isEmpty(authQuery?.code) && userAccessStatus === null) { //callback after successful auth with github
const user = await checkUserCollaboratorStatus(authQuery?.code);
setUserAccessStatus(user)
if (user?.permission) {
window.localStorage.setItem('user', JSON.stringify(user));
}
}
NProgress.done();
setIsLoading(false)
}, [])
if(isLoading) return <p>...</p>
if (userAccessStatus?.permission === false) {
return <DocPageRedirect />
}
if (userAccessStatus === null) {
return <DocPageAuthentication />
}
}
export default DocPageCustom

View File

@@ -1,29 +0,0 @@
import React, { useEffect, useState } from "react";
import style from './DocPageRedirect.module.css'
export default function DocPageRedirect() {
const [counter, setCounter] = useState(10)
useEffect(() => {
setTimeout(() => window.location.href = process.env.REACT_APP_DAGGER_SITE_URI, 10000)
setInterval(() => setCounter((prevState) => prevState - 1), 1000)
}, [])
return (
<div data-cy="cy-page-redirect" className={`container ${style.wrapper}`}>
<div className={`row ${style.row}`}>
<div className="col col--4 col--offset-2">
<h1 className={style.h1}>Oups!</h1>
<p>It seems you don't have the permission to see Dagger's documentation. But don't worry you can request an Eary Access :). You'll be redirect to Dagger website in {counter} seconds </p>
<p>See you soon !</p>
<br />
<small><strong>If nothing happen, <a href={process.env.REACT_APP_DAGGER_SITE_URI}>click here</a> to go to Dagger website</strong></small>
</div>
<div className="col col--4">
<img src="/img/dagger-astronaute.png" alt="" />
</div>
</div>
</div>
)
}

View File

@@ -1,25 +0,0 @@
.wrapper {
background: linear-gradient(180deg, #131226, #0e2b3d);
height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
color: var(--ifm-color-primary-light);
max-width: 100%;
}
.wrapper a {
color: var(--ifm-color-primary-light);
text-decoration: underline;
}
.h1 {
margin-bottom: 2rem;
}
.row {
justify-content: center;
align-content: center;
align-items: center;
}