Skip to content

Commit 74a4ba0

Browse files
committed
Don't block center dashboard pages (+ other alignment tweaks)
1 parent e536d97 commit 74a4ba0

File tree

11 files changed

+36
-33
lines changed

11 files changed

+36
-33
lines changed

frontend/src/components/AccountSwitcher.mlx

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,29 @@ open Melange_json.Primitives
44
open React
55
module Aria = ReactAria
66

7+
let button_class_inline =
8+
"group inline-flex flex-row items-center px-1.5 py-1 -mx-0.75 -my-1 \
9+
rounded-lg focus-visible:outline-none hover:bg-mist-20/40 \
10+
active:bg-mist-20/40"
11+
12+
let button_class_default =
13+
"group min-w-48 flex flex-row items-center gap-x-1 px-2 py-1.5 -mx-2 \
14+
rounded-lg focus-visible:outline-none hover:bg-mist-20/40 \
15+
active:bg-mist-20/40"
16+
17+
let value_class_inline = "text-mana-100 font-serif inline-flex items-center gap-x-1"
18+
19+
let value_class_default = "text-mana-100 font-serif flex items-center gap-x-1"
20+
721
type actor =
822
{did: string; handle: string; avatar_data_uri: string option [@default None]}
923
[@@deriving json]
1024

11-
let fallback handle avatar =
12-
<button className="flex px-2 py-1.5 -mx-2 rounded-lg">
13-
<span className="text-mana-100 font-serif flex items-center gap-x-1">
25+
let fallback handle avatar inline =
26+
let button_class = if inline then button_class_inline else button_class_default in
27+
let value_class = if inline then value_class_inline else value_class_default in
28+
<button className=button_class>
29+
<span className=value_class>
1430
(match avatar with
1531
| Some uri -> <img className="w-5 h-5 mr-1 rounded-md" src=uri />
1632
| None -> null)
@@ -50,21 +66,9 @@ let[@react.component] make ~current_user ~logged_in_users ~add_account_url
5066
() )
5167
else ()]
5268
in
53-
let button_class =
54-
if inline then
55-
"group inline-flex flex-row items-center px-1.5 py-1 -mx-0.75 -my-1 \
56-
rounded-lg focus-visible:outline-none hover:bg-mist-20/40 \
57-
active:bg-mist-20/40"
58-
else
59-
"group min-w-48 flex flex-row items-center gap-x-1 px-2 py-1.5 -mx-2 \
60-
rounded-lg focus-visible:outline-none hover:bg-mist-20/40 \
61-
active:bg-mist-20/40"
62-
in
63-
let value_class =
64-
if inline then "text-mana-100 font-serif inline-flex items-center gap-x-1"
65-
else "text-mana-100 font-serif flex items-center gap-x-1"
66-
in
67-
<ClientOnly fallback=(fallback current_user.handle current_user.avatar_data_uri)>
69+
let button_class = if inline then button_class_inline else button_class_default in
70+
let value_class = if inline then value_class_inline else value_class_default in
71+
<ClientOnly fallback=(fallback current_user.handle current_user.avatar_data_uri inline)>
6872
[%browser_only
6973
(fun () ->
7074
<Aria.Select name className="inline" defaultValue=current_user.did placeholder="select account" onChange=handleAccountSwitch>

frontend/src/templates/AccountPage.mlx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ let[@react.component] make
7878
let confirmEmailLoading, setConfirmEmailLoading = useState (fun () -> false) in
7979
let confirmEmailTokenInput, setConfirmEmailTokenInput = useState (fun () -> "") in
8080
let successMessage, setSuccessMessage = useState (fun () -> success) in
81-
<div className="w-auto h-auto px-4 sm:px-0 flex flex-col md:flex-row gap-12">
81+
<div className="w-auto h-full px-4 sm:px-0 pt-16 mx-auto flex flex-col md:flex-row gap-12">
8282
<AccountSidebar
8383
current_user logged_in_users active_page="/account"
8484
/>

frontend/src/templates/AccountPermissionsPage.mlx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ let[@react.component] make
6767
~props:
6868
({current_user; logged_in_users; csrf_token; authorized_apps; devices} :
6969
props ) () =
70-
<div className="w-auto h-auto px-4 sm:px-0 flex flex-col md:flex-row gap-12">
70+
<div className="w-auto h-full px-4 sm:px-0 pt-16 mx-auto flex flex-col md:flex-row gap-12">
7171
<AccountSidebar
7272
current_user logged_in_users active_page="/account/permissions"
7373
/>

frontend/src/templates/AdminInvitesPage.mlx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ let[@react.component] make
3838
let editRemaining, setEditRemaining = useState (fun () -> "") in
3939
(* delete confirmation state *)
4040
let deleteConfirmFor, setDeleteConfirmFor = useState (fun () -> (None : invite option)) in
41-
<div className="w-full max-w-3xl h-auto px-4 sm:px-0 flex flex-col md:flex-row gap-12">
41+
<div className="w-full max-w-3xl h-full px-4 sm:px-0 pt-16 mx-auto flex flex-col md:flex-row gap-12">
4242
<Sidebar pages=admin_pages active_page="/admin/invites" />
4343
<main className="flex-1 w-full max-w-2xl">
4444
<h1 className="text-2xl font-serif text-mana-200 mb-1">

frontend/src/templates/AdminLoginPage.mlx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ type props = {csrf_token: string; error: string option [@default None]}
55
[@@deriving json]
66

77
let[@react.component] make ~props:({csrf_token; error} : props) () =
8-
<main className="w-full h-auto max-w-xs px-4 sm:px-0">
8+
<main className="w-full h-auto max-w-xs px-4 sm:px-0 my-auto">
99
<h1 className="text-2xl font-serif text-mana-200 mb-2">(string "admin")</h1>
1010
<span className="w-full text-balance text-mist-100">
1111
(string "Enter the admin password to continue.")

frontend/src/templates/AdminUsersPage.mlx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ let[@react.component] make
6262
let editValue, setEditValue = useState (fun () -> "") in
6363
(* delete confirmation state *)
6464
let deleteConfirmFor, setDeleteConfirmFor = useState (fun () -> (None : actor option)) in
65-
<div className="w-full max-w-3xl h-auto mx-8 px-4 sm:px-0 flex flex-col md:flex-row gap-12">
65+
<div className="w-full max-w-3xl h-full px-4 sm:px-0 pt-16 mx-auto flex flex-col md:flex-row gap-12">
6666
<Sidebar pages=admin_pages active_page="/admin/users" />
6767
<main className="flex-1 w-full max-w-2xl">
6868
<h1 className="text-2xl font-serif text-mana-200 mb-1">

frontend/src/templates/Layout.mlx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
open React
22

3-
let[@react.component] make ?(title = "Pegasus") ?(children = null)
4-
?(favicon = "/public/favicon.ico") () =
3+
let[@react.component] make ?(title = "Pegasus") ?(children = null) ?(favicon = "/public/favicon.ico") () =
54
<html lang="en">
65
<head>
76
<meta charSet="utf-8" />
@@ -33,7 +32,7 @@ let[@react.component] make ?(title = "Pegasus") ?(children = null)
3332
</head>
3433
<body
3534
className="bg-feather-100 font-sans font-normal text-base tracking-normal">
36-
<div id="root" className="flex items-center justify-center min-h-screen">
35+
<div id="root" className="flex justify-center min-h-screen">
3736
children
3837
</div>
3938
</body>

frontend/src/templates/LoginPage.mlx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ type props =
99

1010
let[@react.component] make ~props:({redirect_url; csrf_token; error} : props) ()
1111
=
12-
<main className="w-full h-auto max-w-xs px-4 sm:px-0">
12+
<main className="w-full h-auto max-w-xs px-4 sm:px-0 my-auto">
1313
<h1 className="text-2xl font-serif text-mana-200 mb-2">
1414
(string "sign in")
1515
</h1>

frontend/src/templates/OauthAuthorizePage.mlx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -542,14 +542,14 @@ let[@react.component] make
542542
let rendered_name =
543543
match client_name with
544544
| Some client_name ->
545-
<span className="text-mana-100 font-serif mr-1">
545+
<span className="text-mana-100 font-serif">
546546
(string client_name)
547547
<span className="font-sans">(string (" (" ^ host ^ ")"))</span>
548548
</span>
549549
| None when String.length path = 0 ->
550-
<span className="text-mana-100 font-serif mr-1">(string host)</span>
550+
<span className="text-mana-100 font-serif">(string host)</span>
551551
| None ->
552-
<span className="text-mana-100 font-serif mr-1">
552+
<span className="text-mana-100 font-serif">
553553
(string host) <span className="text-mana-40">(string path)</span>
554554
</span>
555555
in
@@ -565,7 +565,7 @@ let[@react.component] make
565565
useState (fun () ->
566566
Option.value logo_uri ~default:("https://" ^ host ^ "/favicon.ico") )
567567
in
568-
<form className="w-full h-auto max-w-lg px-4 sm:px-0">
568+
<form className="w-full h-auto max-w-lg px-4 sm:px-0 my-auto">
569569
<h1 className="text-2xl font-serif text-mana-200 mb-2">
570570
(string ("authorizing " ^ host))
571571
</h1>

frontend/src/templates/RootPage.mlx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ let pegasus =
3232
type props = unit [@@deriving json]
3333

3434
let[@react.component] make ~props:(_ : props) () =
35-
<main className="text-mist-100">
35+
<main className="my-auto text-mist-100">
3636
<pre className="text-mana-100">pegasus</pre>
3737
<p>
3838
(string "this is ")

0 commit comments

Comments
 (0)