Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
go
Commits
20bd3bab
Commit
20bd3bab
authored
Dec 11, 2018
by
David Haynes
🙆
Browse files
Finish merge
- Also Prettier things up
parent
70fcd31c
Pipeline
#3458
passed with stage
in 53 seconds
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
go/go_ahead/src/App.js
View file @
20bd3bab
import
React
from
'
react
'
;
import
ReactDOM
from
'
react-dom
'
;
import
{
HashRouter
,
Route
,
Link
}
from
'
react-router-dom
'
;
import
React
from
"
react
"
;
import
ReactDOM
from
"
react-dom
"
;
import
{
HashRouter
,
Route
,
Link
}
from
"
react-router-dom
"
;
import
{
Routes
}
from
'
Utils
'
;
import
{
Routes
}
from
"
Utils
"
;
// Apply Global Masonstrap styling
import
'
masonstrap/build/css/masonstrap.min.css
'
;
import
'
masonstrap/build/js/masonstrap.min.js
'
;
import
"
masonstrap/build/css/masonstrap.min.css
"
;
import
"
masonstrap/build/js/masonstrap.min.js
"
;
ReactDOM
.
render
(
<
HashRouter
>
<
Routes
/>
<
/HashRouter>
,
document
.
getElementById
(
'
root
'
)
<
HashRouter
>
<
Routes
/>
<
/HashRouter>
,
document
.
getElementById
(
"
root
"
)
);
go/go_ahead/src/AuthButton.jsx
deleted
100644 → 0
View file @
70fcd31c
import
React
from
"
react
"
;
import
{
Button
}
from
"
reactstrap
"
;
class
AuthButton
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
error
:
null
,
is_auth
:
false
};
}
componentDidMount
()
{
fetch
(
"
/auth/status
"
)
.
then
(
res
=>
res
.
json
())
.
then
(
result
=>
{
this
.
setState
({
is_auth
:
result
.
is_authenticated
});
},
error
=>
{
this
.
setState
({
error
});
}
);
}
render
()
{
const
{
is_auth
,
error
}
=
this
.
state
;
if
(
error
)
{
return
<
div
>
Error:
{
error
.
message
}
</
div
>;
}
else
{
return
(
<
div
>
{
is_auth
?
(
<
Button
color
=
"info"
href
=
"/auth/logout"
>
Logout
</
Button
>
)
:
(
<
Button
color
=
"info"
href
=
"/auth/login"
>
Login
</
Button
>
)
}
</
div
>
);
}
}
}
export
default
AuthButton
;
go/go_ahead/src/Components/Molecules/AuthButton.js
View file @
20bd3bab
import
React
from
'
react
'
;
import
{
Button
}
from
'
reactstrap
'
;
import
React
from
"
react
"
;
import
{
Button
}
from
"
reactstrap
"
;
export
default
class
AuthButton
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
is_auth
:
false
};
}
class
AuthButton
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
error
:
null
,
is_auth
:
false
};
}
componentDidMount
()
{
this
.
setState
(()
=>
{
return
{
is_auth
:
window
.
django
.
user
.
is_authenticated
==
'
True
'
};
});
}
componentDidMount
()
{
fetch
(
"
/auth/status
"
)
.
then
(
res
=>
res
.
json
())
.
then
(
result
=>
{
this
.
setState
({
is_auth
:
result
.
is_authenticated
});
},
error
=>
{
this
.
setState
({
error
});
}
);
}
render
()
{
return
(
<
div
>
{
this
.
state
.
is_auth
?
(
<
Button
color
=
"
info
"
href
=
"
/auth/logout
"
>
Logout
<
/Button
>
)
:
(
<
Button
color
=
"
info
"
href
=
"
/auth/login
"
>
Login
<
/Button
>
)}
<
/div
>
);
render
()
{
const
{
is_auth
,
error
}
=
this
.
state
;
if
(
error
)
{
return
<
div
>
Error
:
{
error
.
message
}
<
/div>
;
}
else
{
return
(
<
div
>
{
is_auth
?
(
<
Button
color
=
"
info
"
href
=
"
/auth/logout
"
>
Logout
<
/Button
>
)
:
(
<
Button
color
=
"
info
"
href
=
"
/auth/login
"
>
Login
<
/Button
>
)}
<
/div
>
);
}
}
}
export
default
AuthButton
;
go/go_ahead/src/Components/Molecules/index.js
View file @
20bd3bab
import
AuthButton
from
'
./AuthButton
'
;
import
AuthButton
from
"
./AuthButton
"
;
export
{
AuthButton
};
go/go_ahead/src/Components/Organisms/NavBar.js
View file @
20bd3bab
import
React
from
'
react
'
;
import
{
Navbar
,
NavbarBrand
,
Nav
,
NavItem
,
NavLink
}
from
'
reactstrap
'
;
import
React
from
"
react
"
;
import
{
Navbar
,
NavbarBrand
,
Nav
,
NavItem
,
NavLink
}
from
"
reactstrap
"
;
export
default
class
NavBar
extends
React
.
Component
{
render
()
{
return
(
<
div
>
<
Navbar
color
=
"
dark
"
dark
expand
=
"
md
"
>
<
NavbarBrand
href
=
"
#
"
>
Go
<
/NavbarBrand
>
render
()
{
return
(
<
div
>
<
Navbar
color
=
"
dark
"
dark
expand
=
"
md
"
>
<
NavbarBrand
href
=
"
#
"
>
Go
<
/NavbarBrand
>
<
Nav
className
=
"
ml-auto
"
navbar
>
<
NavItem
>
<
NavLink
href
=
"
#/dhaynes
"
active
=
{
this
.
props
.
page
==
'
dhaynes
'
}
>
Dhaynes
<
/NavLink
>
<
/NavItem
>
<
NavItem
>
<
NavLink
href
=
"
#/about
"
active
=
{
this
.
props
.
page
==
'
about
'
}
>
About
<
/NavLink
>
<
/NavItem
>
<
/Nav
>
<
/Navbar
>
<
/div
>
);
}
<
Nav
className
=
"
ml-auto
"
navbar
>
<
NavItem
>
<
NavLink
href
=
"
#/dhaynes
"
active
=
{
this
.
props
.
page
==
"
dhaynes
"
}
>
Dhaynes
<
/NavLink
>
<
/NavItem
>
<
NavItem
>
<
NavLink
href
=
"
#/about
"
active
=
{
this
.
props
.
page
==
"
about
"
}
>
About
<
/NavLink
>
<
/NavItem
>
<
/Nav
>
<
/Navbar
>
<
/div
>
);
}
}
go/go_ahead/src/Components/Organisms/index.js
View file @
20bd3bab
import
NavBar
from
'
./NavBar
'
;
import
NavBar
from
"
./NavBar
"
;
export
{
NavBar
};
go/go_ahead/src/Components/index.js
View file @
20bd3bab
import
{
PageTemplate
}
from
'
./Templates
'
;
import
{
HomePage
,
AboutPage
,
DhaynesPage
}
from
'
./Pages
'
;
import
{
NavBar
}
from
'
./Organisms
'
;
import
{
AuthButton
}
from
'
./Molecules
'
;
import
{
PageTemplate
}
from
"
./Templates
"
;
import
{
HomePage
,
AboutPage
,
DhaynesPage
}
from
"
./Pages
"
;
import
{
NavBar
}
from
"
./Organisms
"
;
import
{
AuthButton
}
from
"
./Molecules
"
;
export
{
//Tempaltes
PageTemplate
,
//Pages
HomePage
,
AboutPage
,
DhaynesPage
,
//Organisms
NavBar
,
//Molecules
AuthButton
,
//Tempaltes
PageTemplate
,
//Pages
HomePage
,
AboutPage
,
DhaynesPage
,
//Organisms
NavBar
,
//Molecules
AuthButton
};
go/go_ahead/src/Utils/Routes.js
View file @
20bd3bab
import
React
from
'
react
'
;
import
{
Route
}
from
'
react-router-dom
'
;
import
React
from
"
react
"
;
import
{
Route
}
from
"
react-router-dom
"
;
import
{
HomePage
,
AboutPage
,
DhaynesPage
}
from
'
Components
'
;
import
{
HomePage
,
AboutPage
,
DhaynesPage
}
from
"
Components
"
;
const
Routes
=
()
=>
(
<
div
>
<
Route
path
=
"
/
"
exact
component
=
{
HomePage
}
/
>
<
Route
path
=
"
/dhaynes
"
component
=
{
DhaynesPage
}
/
>
<
Route
path
=
"
/about
"
component
=
{
AboutPage
}
/
>
<
/div
>
<
div
>
<
Route
path
=
"
/
"
exact
component
=
{
HomePage
}
/
>
<
Route
path
=
"
/dhaynes
"
component
=
{
DhaynesPage
}
/
>
<
Route
path
=
"
/about
"
component
=
{
AboutPage
}
/
>
<
/div
>
);
export
default
Routes
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment