Skip to content

Commit 1a73ae5

Browse files
committed
Fix text truncation on frontend, improve buttons
1 parent 5adf5ed commit 1a73ae5

File tree

5 files changed

+36
-27
lines changed

5 files changed

+36
-27
lines changed

frontend/src/components/Button.mlx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
let base_classes =
22
"py-1 px-4 text-lg rounded-lg w-full flex items-center justify-center \
3-
transition delay-50 duration-300 focus-visible:outline-none \
4-
disabled:text-mist-80"
3+
transition duration-300 focus-visible:outline-none disabled:text-mist-80"
54

65
type kind = [`Primary | `Secondary | `Tertiary | `Danger]
76

87
let classes = function
98
| `Primary ->
109
base_classes
1110
^ " bg-white font-serif text-mana-200 shadow-whisper \
12-
hover:shadow-shimmer hover:bg-mist-20 focus-visible:shadow-shimmer \
13-
focus-visible:bg-mist-20 active:shadow-glow disabled:bg-mana-40"
11+
hover:shadow-shimmer hover:bg-mist-20 hover:text-mist-100 \
12+
focus-visible:shadow-shimmer focus-visible:bg-mist-20 \
13+
focus-visible:text-mist-100 active:shadow-glow active:text-mana-100 \
14+
disabled:bg-mist-60 disabled:shadow-none"
1415
| `Secondary ->
1516
base_classes
1617
^ " bg-feather font-serif underline text-mana-100 hover:no-underline \
1718
focus-visible:shadow-whisper active:shadow-whisper \
18-
disabled:no-underline disabled:bg-mana-40"
19+
disabled:no-underline disabled:bg-mist-60 disabled:shadow-none"
1920
| `Tertiary ->
2021
base_classes
2122
^ " font-sans underline text-mana-100 hover:no-underline \
@@ -24,7 +25,8 @@ let classes = function
2425
base_classes
2526
^ " bg-white font-serif text-phoenix-100 shadow-bleed hover:bg-mist-20 \
2627
focus:bg-mist-20 focus:text-phoenix-40 focus-visible:outline-none \
27-
active:bg-phoenix-40 active:text-mist-20 disabled:bg-mana-40"
28+
active:bg-phoenix-40 active:text-mist-20 disabled:bg-mist-60 \
29+
disabled:shadow-none"
2830
| `Danger_secondary ->
2931
base_classes
3032
^ " bg-feather font-serif underline text-phoenix-100 hover:no-underline \

frontend/src/templates/AccountPermissionsPage.mlx

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ 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-full px-4 sm:px-0 pt-16 mx-auto flex flex-col md:flex-row gap-12">
70+
<div
71+
className="w-auto h-full max-w-full px-4 sm:px-0 pt-16 mx-auto flex \
72+
flex-col md:flex-row gap-12">
7173
<AccountSidebar
7274
current_user logged_in_users active_page="/account/permissions"
7375
/>
@@ -87,17 +89,24 @@ let[@react.component] make
8789
<ul className="space-y-2">
8890
( List.map
8991
(fun (app : authorized_app) ->
92+
let name = Option.value app.client_name ~default:app.client_host in
9093
<li key=app.client_id className="flex items-center gap-x-2">
91-
<span className="font-serif text-mana-100">
92-
(string
93-
(Option.value app.client_name
94-
~default:app.client_host ) )
94+
<span
95+
title=name
96+
className="flex-1 max-w-fit font-serif text-mana-100 \
97+
truncate">
98+
(string name)
9599
</span>
96100
( match app.client_name with
97101
| Some _ ->
98-
<span className="text-mist-80">
99-
(string ("(" ^ app.client_host ^ ")"))
100-
</span>
102+
array
103+
[| <span className="text-mist-80">(string "-")</span>
104+
; <span
105+
title=app.client_host
106+
className="flex-2 max-w-fit block \
107+
text-mist-80 truncate">
108+
(string app.client_host)
109+
</span> |]
101110
| None ->
102111
null )
103112
<span className="text-mist-80">(string "-")</span>
@@ -112,7 +121,7 @@ let[@react.component] make
112121
formMethod="post"
113122
name="action"
114123
value="revoke_app"
115-
className="text-mist-100 underline \
124+
className="text-mist-100 underline whitespace-nowrap \
116125
hover:text-mana-100">
117126
(string "revoke access")
118127
</button>
@@ -138,7 +147,7 @@ let[@react.component] make
138147
let key = device.last_ip ^ "-" ^ string_of_int i in
139148
<li key className="flex flex-col">
140149
<div className="flex items-center gap-x-2">
141-
<span className="font-serif text-mana-100">
150+
<span className="font-serif text-mana-100 truncate">
142151
(string (parse_user_agent device.last_user_agent))
143152
</span>
144153
( if device.is_current then
@@ -165,13 +174,13 @@ let[@react.component] make
165174
formMethod="post"
166175
name="action"
167176
value="sign_out_device"
168-
className="text-mist-100 underline \
177+
className="text-mist-100 underline whitespace-nowrap \
169178
hover:text-mana-100">
170179
(string "sign out")
171180
</button>
172181
</form>
173182
</div>
174-
<span className="text-sm text-mist-80">
183+
<span className="text-sm text-mist-80 truncate">
175184
(string
176185
( "Last active " ^ device.last_refreshed_at
177186
^ {js| · |js} ^ device.last_ip ) )

frontend/src/templates/Layout.mlx

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

3-
let[@react.component] make ?(title = "Pegasus") ?(children = null) ?(favicon = "/public/favicon.ico") () =
3+
let[@react.component] make ?(title = "Pegasus") ?(children = null)
4+
?(favicon = "/public/favicon.ico") () =
45
<html lang="en">
56
<head>
67
<meta charSet="utf-8" />
@@ -32,8 +33,6 @@ let[@react.component] make ?(title = "Pegasus") ?(children = null) ?(favicon = "
3233
</head>
3334
<body
3435
className="bg-feather-100 font-sans font-normal text-base tracking-normal">
35-
<div id="root" className="flex justify-center min-h-screen">
36-
children
37-
</div>
36+
<div id="root" className="flex justify-center min-h-screen">children</div>
3837
</body>
3938
</html>

pegasus/lib/env.ml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ let crawlers =
5050
| _ ->
5151
Uri.make ~scheme:"https" ~host:u () )
5252

53-
let favicon_url =
54-
getenv_opt "PDS_FAVICON_URL" ~default:"/public/favicon.ico"
53+
let favicon_url = getenv_opt "PDS_FAVICON_URL" ~default:"/public/favicon.ico"
5554

5655
let dpop_nonce_secret =
5756
match getenv_opt "PDS_DPOP_NONCE_SECRET" ~default:"" with

public/main.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
--color-mist-100: #4f4f53;
6262

6363
--shadow-whisper: inset 0 0 1em #97baff8c;
64-
--shadow-shimmer: inset 0 0 1em #79a7ed99;
65-
--shadow-glow: inset 0 0 2em #2d37ba73;
66-
--shadow-bleed: inset 0 0 2em #db4c6466;
64+
--shadow-shimmer: inset 0 0 1em #90bbeea6;
65+
--shadow-glow: inset 0 0 1.25em #2d37ba80;
66+
--shadow-bleed: inset 0 0 1.25em #db4c6473;
6767
}

0 commit comments

Comments
 (0)