Browse Source

fix(desktop): move session context to top-right

Adam 1 month ago
parent
commit
7469cba7cf

+ 4 - 2
packages/app/src/components/prompt-input.tsx

@@ -989,7 +989,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
             onInput={handleInput}
             onKeyDown={handleKeyDown}
             classList={{
-              "w-full px-5 py-3 text-14-regular text-text-strong focus:outline-none whitespace-pre-wrap": true,
+              "w-full px-5 py-3 pr-12 text-14-regular text-text-strong focus:outline-none whitespace-pre-wrap": true,
               "[&_[data-type=file]]:text-icon-info-active": true,
               "font-mono!": store.mode === "shell",
             }}
@@ -1001,6 +1001,9 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
                 : `Ask anything... "${PLACEHOLDERS[store.placeholder]}"`}
             </div>
           </Show>
+          <div class="absolute top-4.5 right-4">
+            <SessionContextUsage />
+          </div>
         </div>
         <div class="relative p-3 flex items-center justify-between">
           <div class="flex items-center justify-start gap-1">
@@ -1057,7 +1060,6 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
                 </Tooltip>
               </Match>
             </Switch>
-            <SessionContextUsage />
           </div>
           <div class="flex items-center gap-1 absolute right-2 bottom-2">
             <input

+ 12 - 13
packages/app/src/components/session-context-usage.tsx

@@ -34,28 +34,27 @@ export function SessionContextUsage() {
     <Show when={context?.()}>
       {(ctx) => (
         <Tooltip
-          openDelay={300}
           value={
-            <div class="flex flex-col gap-1 p-2">
-              <div class="flex justify-between gap-4">
-                <span class="text-text-weaker">Tokens</span>
-                <span class="text-text-strong">{ctx().tokens}</span>
+            <div class="flex flex-col gap-1">
+              <div class="flex gap-3">
+                <span class="opacity-70 text-right flex-1">Tokens</span>
+                <span class="text-left flex-1">{ctx().tokens}</span>
               </div>
-              <div class="flex justify-between gap-4">
-                <span class="text-text-weaker">Usage</span>
-                <span class="text-text-strong">{ctx().percentage ?? 0}%</span>
+              <div class="flex gap-3">
+                <span class="opacity-70 text-right flex-1">Usage</span>
+                <span class="text-left flex-1">{ctx().percentage ?? 0}%</span>
               </div>
-              <div class="flex justify-between gap-4">
-                <span class="text-text-weaker">Cost</span>
-                <span class="text-text-strong">{cost()}</span>
+              <div class="flex gap-3">
+                <span class="opacity-70 text-right flex-1">Cost</span>
+                <span class="text-left flex-1">{cost()}</span>
               </div>
             </div>
           }
           placement="top"
         >
-          <div class="flex items-center gap-1">
-            <span class="text-12-medium text-text-weak">{`${ctx().percentage ?? 0}%`}</span>
+          <div class="flex items-center gap-1.5">
             <ProgressCircle size={16} strokeWidth={2} percentage={ctx().percentage ?? 0} />
+            {/* <span class="text-12-medium text-text-weak">{`${ctx().percentage ?? 0}%`}</span> */}
           </div>
         </Tooltip>
       )}