Add logged-in state to WIP new top nav - #3332
Conversation
| return value === 'small' || value === 'medium' || value === 'large'; | ||
| } | ||
|
|
||
| export function generateFallbackText(text: string): string { |
There was a problem hiding this comment.
This logic is ported from how Octopus Server generates the fallback initials for avatars.
|
|
||
| function readCookie(): string | null { | ||
| const match = document.cookie.match( | ||
| new RegExp(`(^|;\\s*)${USER_COOKIE}=([^;]+)`) |
There was a problem hiding this comment.
This is ported from how octopus.com itself reads from the cookie
ae99082 to
deb2579
Compare
|
Pull request environment is available at https://stoctodocspr3332.z22.web.core.windows.net. You can view the ephemeral environment status in Octopus Deploy. This environment will be automatically deprovisioned when the pull request is closed, or after 7 days of inactivity. |
| import { test, expect } from '@playwright/test'; | ||
| import { generateFallbackText } from '../src/lib/avatar'; | ||
|
|
||
| const cases: [string, string][] = [ |
There was a problem hiding this comment.
This is a simplified version of the tests we have for Octopus Server's generateFallbackText.
deb2579 to
8b8b3a9
Compare
ellen-octopus
left a comment
There was a problem hiding this comment.
Looks excellent 👏🏻 thanks @rosslovas!
| agentic | ||
| allatclaims | ||
| ALLUSERSPROFILE | ||
| andré |
There was a problem hiding this comment.
Adding the names of fake people used in the unit tests to our dictionary doesn't feel like the right way to solve this problem. IIRC the spell check has an exclude list, can we add the tests folder to it? It really makes no sense to spellcheck unit tests
There was a problem hiding this comment.
Done! I didn't really mind as I like not having typos lying around but it makes sense that the intention of this particular spellcheck is really the markdown :)
borland
left a comment
There was a problem hiding this comment.
Spellchecking unit tests feels a bit naff, but otherwise all the code looks good to me and I would approve
8b8b3a9 to
656542a
Compare
Summary
This PR adds an avatar component from our design system ported to Astro, and displays it in the new TopNav (in place of the Sign in and Start for free buttons) when the user is signed in on octopus.com.
Results
When signed in:
Light mode

Dark mode

(In production, if you have an avatar image set up, that should be displayed in place of the placeholder initials.)
See in action at https://stoctodocspr3332.z22.web.core.windows.net/components#avatar. Because this isn't actually live on octopus.com yet, you can't actually sign in on the staging site. However, you can test the logged in state on the staging site by populating the cookie with fake data, by running the following JS via the browser console:
To reset: