From 0627b7203133cf249c2e928572ed2b78e5e13cdc Mon Sep 17 00:00:00 2001
From: Reid 'arrdem' McKenzie <me@arrdem.com>
Date: Sat, 27 May 2023 00:45:34 -0600
Subject: [PATCH] Some bare minimum of styling the API key page

---
 .../src/python/tentacles/static/css/style.scss     | 14 ++++++++++++++
 .../src/python/tentacles/templates/user.html.j2    |  6 +++---
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/projects/tentacles/src/python/tentacles/static/css/style.scss b/projects/tentacles/src/python/tentacles/static/css/style.scss
index 4b3bb49..23db6f5 100644
--- a/projects/tentacles/src/python/tentacles/static/css/style.scss
+++ b/projects/tentacles/src/python/tentacles/static/css/style.scss
@@ -307,3 +307,17 @@ form {
   border-radius: 1em;
   padding: 0.5em;
 }
+
+.keys ul li {
+  display: flex;
+  flex-direction: row;
+
+  span {
+    margin-right: 1em;
+  }
+
+  .key-key {
+    max-width: 20em;
+    overflow: clip;
+  }
+}
diff --git a/projects/tentacles/src/python/tentacles/templates/user.html.j2 b/projects/tentacles/src/python/tentacles/templates/user.html.j2
index a70290b..fdd9ca0 100644
--- a/projects/tentacles/src/python/tentacles/templates/user.html.j2
+++ b/projects/tentacles/src/python/tentacles/templates/user.html.j2
@@ -1,14 +1,14 @@
 {% extends "base.html.j2" %}
 {% block content %}
 <h1>User settings</h1>
-<div class="">
+<div class="keys">
   <h2>API keys</h2>
   {% with keys = ctx.db.list_keys(ctx.uid) %}
   <ul>
     {% for id, name, exp in keys if name != 'web session' %}
     <li>
-      <span class="key-name">{{ name }}</span>
-      <span class="key-key">{{ id }}</span>
+      <span class="key-name">{{ name or 'anonymous' }}</span>
+      <span class="key-key">{{ id[:10] }}...</span>
       <span class="key-expiration">{{ 'Expires in' if exp else ''}} {{ exp - datetime.now() if exp else 'Never' }}</span>
       <form method="post">
         <input type="hidden" name="action" value="revoke">