Skip to content

Commit d002e2e

Browse files
committed
chore: update
1 parent 4bbf33c commit d002e2e

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

‎packages/devframe/src/recipes/interactive-auth.ts‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,22 +86,23 @@ export function createAuthBanner(options: CreateAuthBannerOptions = {}): AuthBan
8686
const title = options.title ?? 'Devframe'
8787
const palette: CreateAuthBannerColorsOptions = {
8888
border: colors.dim,
89-
title: colors.bold,
89+
title: x => colors.gray(colors.bold(x)),
9090
label: colors.dim,
91-
code: colors.bold,
91+
code: f => colors.green(colors.bold(f)),
9292
url: colors.cyan,
9393
...options.colors,
9494
}
9595

9696
return (info) => {
97-
const minutesLeft = Math.max(1, Math.round((info.expireAt - Date.now()) / 60_000))
9897
const rows: [label: string, value: string, color: ColorFn][] = [
9998
['auth code', info.code, palette.code],
10099
['or open', info.url, palette.url],
101-
['expires', `in ${minutesLeft} minute${minutesLeft === 1 ? '' : 's'}`, palette.label],
100+
['expires at', new Date(info.expireAt).toLocaleTimeString(), palette.label],
102101
]
103-
if (info.requester)
104-
rows.push(['for', `${info.requester.ua} (${info.requester.origin})`, palette.label])
102+
if (info.requester) {
103+
rows.push(['ua', info.requester.ua, palette.label])
104+
rows.push(['origin', info.requester.origin, palette.label])
105+
}
105106
const labelWidth = Math.max(...rows.map(([label]) => label.length))
106107
const contentWidth = Math.max(...rows.map(([, value]) => labelWidth + 2 + value.length))
107108
const titleBarLength = title.length + 3

0 commit comments

Comments
 (0)