diff --git a/app/javascript/components/App.tsx b/app/javascript/components/App.tsx index 318d53d..e9b2e63 100644 --- a/app/javascript/components/App.tsx +++ b/app/javascript/components/App.tsx @@ -2,19 +2,41 @@ import React, { useState, useEffect } from 'react'; const App = () => { const [appVersion, setAppVersion] = useState(null); + const [userSignedIn, setUserSignedIn] = useState(false); useEffect(() => { setAppVersion(document.body.getAttribute('data-app-version')); + setUserSignedIn(document.body.getAttribute('data-user-signed-in') == 'true'); }, [appVersion]) if (!appVersion) { return 'Loading...'; } + function renderUserSignInLinks() { + return userSignedIn + ? ( +
+ + + +
+ ) + : Sign in; + } + return (

Triclops

{`Version ${appVersion}`}

+ {renderUserSignInLinks()}
); }; diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb new file mode 100644 index 0000000..f5ed6ab --- /dev/null +++ b/app/views/devise/sessions/new.html.erb @@ -0,0 +1,11 @@ +

Log in

+ +<%= render "devise/shared/links" %> + +<% if Rails.env.development? %> +

+ Development environment only: +

+ <%= link_to 'Sign in with development account', users_development_sign_in_developer_path %> +

+<% end %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 044b92f..16d6647 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -19,7 +19,7 @@ <%= vite_typescript_tag 'application.tsx' %> - + <% flash.each do |type, msg| %>
<%= msg %>
<% end %>