1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-06-14 01:16:17 +02:00
Commit Graph

517 Commits

Author SHA1 Message Date
Thomas Heartman
138e93c41a
chore: drag-n-drop tooltip for strategies (#9623)
Implements the drag-n-drop tooltip the first time the user sees a
strategy drag handle on the feature env overview. It uses React Joyride,
which is the same system we use for the demo.

The design is a little different from the sketches because I couldn't
find a quick way to move the content (and the arrow) to be shifted
correctly.

If the demo is also active the first time a user visits a strategy page,
it'll render both the demo steps and this, but this tooltip doesn't
prevent the user from finishing the tour. It might be possible to avoid
that through checking state in localstorage, but I'd like to get this
approved first.

The tooltip uses the auth splash system to decide whether to show the
tooltip, meaning it's stored per user in the DB. To avoid it
re-rendering before you refetch from the back end, we also use a
temporary variable to check whether the user has closed it.

Rendered:

![image](https://github.com/user-attachments/assets/5912d055-10d5-4a1d-93f4-f12ff4ef7419)

If the tour is also active:

![image](https://github.com/user-attachments/assets/b0028a0f-3a0f-48aa-9ab9-8d7cf399055a)
2025-03-27 11:16:37 +01:00
Thomas Heartman
328c5368ed
Hide env metrics when an env has no strategies. (#9620)
Changes the logic in when we display metrics for an env to not showing
 them unless we have strategies.


![image](https://github.com/user-attachments/assets/83dc2465-b3fb-49d1-a9fe-886fd16fea25)
2025-03-26 13:43:12 +00:00
Simon Hornby
dbc953b222
chore: consolidate release plan flags (#9606)
Removes the `releasePlanChangeRequests` flag and swaps existing references to it to the `releasePlans` flag instead
2025-03-25 13:36:23 +02:00
Thomas Heartman
3d1a97f745
Fix(1-3462)/janky drag n drop (#9599)
Fixes janky drag and drop behavior and updates the styling of the drag
handle focus.

The solution uses the same method to prevent oscillation as we do for
strategies. To get access to the same context, I've added some extra
parameters to the OnMoveItem function and passed along the extra data
from the `useDragItem` hook. No new information, just making more of it
available, and turning it into an object so that you can declare the
properties you need (and get rid of potential wrong ordering of
drag/drop indices).

For the drag and drop behavior: If the dragged element is the same size
or smaller than the element you're dragging over, they will swap places
as soon as you enter that space. If the target element is larger,
however, they won't swap until you reach the drag/drop handle, even if
they could theoretically switch somewhere in the middle. This appears to
be a limitation of how the drag/drop event system works. New drag events
are only fired when you "dragenter" a new element, so it never fires
anywhere in the middle. Technically, we could insert more empty spans
inside the drag handle to trigger more events, but I wanna hold off on
that because it doesn't sound great.

When dragging, only the handle is visible; the rest of the card stays in
place. For strategies, we show a "ghost" version of the config you're
dragging. However, if you apply the drag handle to the card itself, all
of it becomes draggable, but you can no longer select the text inside
it, which is unfortunate. Strategies do solev this, though, but I
haven't been able to figure out why. If you know, please share!

Before:

![image](https://github.com/user-attachments/assets/d3bf9fd2-7d74-4ad7-adde-b729403f82b3)


After:

![image](https://github.com/user-attachments/assets/27d3ca4e-112a-4420-b10d-7df59a7c09a0)
2025-03-25 11:43:40 +01:00
Tymoteusz Czech
d8c7e31b18
Constraint values preview and filtering (#9603)
Restore constraint accordion to flag page.
2025-03-25 11:24:22 +01:00
David Leek
7580d3bc74
chore: rename release-management to release-templates, remove "plan" from descriptions (#9595) 2025-03-24 14:57:18 +01:00
Tymoteusz Czech
dd62b3dbcd
Constraint values list (#9592) 2025-03-24 14:26:58 +01:00
Thomas Heartman
01870c6165
fix: wrap env header grid on narrow containers (#9596)
When the container is <500px, make it so that the strategy count wraps
onto its own line to prevent it from obscuring the environment name.

I decided to go for 500px because that allows our default names to not
get cut off before wrapping. It seems like a sensible default.

Before:

![image](https://github.com/user-attachments/assets/7fdec179-6053-4803-9bc0-8e48cedf3636)


After:


![image](https://github.com/user-attachments/assets/64728d51-5f9a-415e-84d1-a7708c039809)

It's still not perfect when you have envs without strategies, but it's
better. We'll get back to that edge case later.
2025-03-24 10:52:38 +01:00
Thomas Heartman
b84699f563
refactor(1-3439): extract shared components and styling from Env Accordion Body to common (#9590)
Extracts the shared strategy list and list item into the `common` folder
instead of living in the environment accordion body file.

Also takes the disabled strategy handling that we use for
`StrategySeparator` and moves it into the file itself. It might be
something we want to decorate manually in the future, but we don't for
now, so this was the most straight-forward way to make it work.
2025-03-24 07:39:35 +00:00
Thomas Heartman
03699c8e80
chore(1-3516): add release plan / strategy count to env header (#9589)
Adds an optional `environmentMetadata` property to the env header
component, which is used to populate the release plan / strategy
counter. If no env metadata is passed (such as for default strategy
configuration) nothing is rendered.


![image](https://github.com/user-attachments/assets/9be29a7a-aa11-46a4-87b4-4596c12552f6)

With long env names, the project name will be cut off before the chip:


![image](https://github.com/user-attachments/assets/0711972b-66d6-4874-9c47-0c4c768807ff)

There's some issues with narrow screens, but I'll handle that in a
follow-up:

![image](https://github.com/user-attachments/assets/0de8aeae-1025-4c7e-9fcb-86dd22952f97)
2025-03-21 14:54:13 +01:00
Tymoteusz Czech
70444c2003
refactor: variant colors (#9586)
Toned-down colors for dark theme
2025-03-20 14:44:33 +01:00
Thomas Heartman
aeb3081624
chore: Don't use fallback functions for dragging (#9585)
Makes it so that strategies project env strategies that aren't draggable
don't get the drag icon. The reason it didn't work as expected was that
we used fallback functions instead of keeping them undefined.

I discovered that we applied two dragging boxes, so I removed the outer
layer one (specific to project envs) in favor of relying on the inner
one. Most of the lines changed are just indentation as a result of this
nesting going away.

Here's the diff. The top set of strategies aren't draggable; the lower
ones are.


![image](https://github.com/user-attachments/assets/0a7b6371-9f34-4596-a85f-9881da821448)
2025-03-20 13:54:19 +01:00
Tymoteusz Czech
2d47fb3827
feat: new constraint view for flag edit page (#9567)
Refactor components in Targeting (Edit strategy)
2025-03-20 13:04:24 +01:00
Thomas Heartman
afd24aa58a
refactor: flatten release plan + strategy list (#9581)
Flattens the list of strategies when you have both release plans and
strategies. If you had both, you'd have this setup before:
```
- ol
  - li // release plan
    - ol // release plan strategies
  - li // regular strategies
    - ol // strategy list
```

Now we drop the extra nesting:
```
- ol
  -  li // release plan
    - ol // release plan strategies
  - li // the rest of the strategies
```

Semantically, I think this is just as valid and it simplifies a lot of
styling that no longer needs to look for other lists etc.

As part of doing this, I have also moved the "many strategies" warnings
and pagination labels to outside the list instead of inside the smaller
list.

Otherwise, the list looks just the same as before and drag-n-drop works
just fine.

(side note: these strategies shouldn't have drag handles 🤔 )

![image](https://github.com/user-attachments/assets/f27f451c-1b73-4f18-903f-153e379b54c1)


As a bonus, this PR also:
- Uses the disabled style separator for disabled strats in playground
and deletes some unused components I found.

Playground disabled strats (we probably don't want double orange badges;
I'll talk to UX):

![image](https://github.com/user-attachments/assets/a722b18f-f3d5-4d53-b093-b44912284748)
2025-03-20 11:16:44 +01:00
Thomas Heartman
038c10f612
chore: finish up disabled strategies (#9579)
Aligns the design of disabled strategies with the sketches. Most notable
changes:
- makes the disabled badge warning yellow
- greys out the preceding "or" separator
- makes the segment "preview" button *not* grey (because it's still
interactable)

As a bonus: uses a list for the constraint value lists instead of a div
and updates the design to match the sketches (no chips).


![image](https://github.com/user-attachments/assets/1b3ddfa0-b0e8-4856-ae01-26e507590a4f)

With strat variants:

![image](https://github.com/user-attachments/assets/dc143fbf-256b-4e96-872b-a6aa84df2111)


Bonus fix: 
Lets the constraint value list wrap so that we avoid this kind of
blowout:

![image](https://github.com/user-attachments/assets/4c0977ac-f8a4-41cc-8fb7-194e8b09c0a3)

Instead: 

![image](https://github.com/user-attachments/assets/a68ed4cf-c68c-43a1-9d6c-b90e85a0841f)
2025-03-19 15:40:23 +01:00
Thomas Heartman
c89cf196e7
Use new strategy execution in playground (#9553)
Implements playground results for strategies.

Old design:

![image](https://github.com/user-attachments/assets/6c1f1bad-4568-4959-82ee-3ebc6a0aab2d)

New design:

![image](https://github.com/user-attachments/assets/8991fc67-7055-4f6c-b2cb-b2d445057962)


Still left: segments.

I also discovered during this that some of the new hooks (and also some
of the new components) accept deprecated types
(`IFeatureStrategyPayload` in this case). If that should indeed be
deprecated, then we also shouldn't use it in the new hooks / components
if we can avoid it. I'll make a task for it.

---------

Co-authored-by: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com>
2025-03-18 11:23:02 +01:00
Thomas Heartman
85ea5ce5e2
chore: Delete unused files (#9542)
These files are never used anywhere, so we might as well remove them.
2025-03-14 11:22:10 +01:00
Thomas Heartman
af705ad0e0
fix(1-3489): strategy dragging is broken in env overview (#9538)
Fixes strategy dragging in project envs. Not sure why this works, but
apparently, making it a variable instead of react component takes care
of it?
2025-03-14 11:22:02 +01:00
Thomas Heartman
732b7f342a
chore: Playground Strategy Lists (#9510)
Continue the implementation of Playground strategy lists. This PR also
adjusts some existing strategy container and list items to accomodate
more use cases (such as this).

The playground strategy execution component is still the old design.

After (playground results):

![image](https://github.com/user-attachments/assets/f32505ba-f040-4491-a298-6e8bf606536d)

After (env strategy list):

![image](https://github.com/user-attachments/assets/b39174c7-3ee2-4fb4-aa7c-b51134c740b8)

Before (env strategy list):

![image](https://github.com/user-attachments/assets/a0a045e5-3623-44ef-96fa-8ba2f5be6b98)
2025-03-13 12:01:44 +01:00
Tymoteusz Czech
863788d7b3
Feat(UI): new strategy variant chips (#9507)
- new way of showing strategy variants
- fixed wrapping issue in strategy editing, for a lot of variants
defined (`SplitPreviewSlider.tsx` change)
- aligned difference between API and manually added types
2025-03-13 11:27:45 +01:00
Thomas Heartman
7dd89034aa
chore: use new designs for project default strategies (#9447)
Implements the new strategy list design for default strategies. Moves
the old impl into a legacy file. Also: removes the description from the
strategy item. From my digging, we only showed this for default strategy
items and it didn't really provide any useful information. The only
other place you can add a description is for custom strategies (at least
that I could find), but these are deprecated and we never show the
description when you apply the strategy anyway.

Rendered:

![image](https://github.com/user-attachments/assets/fb244f10-0a19-42f5-a517-090d6703c76a)

Without the flag (nothing changes):

![image](https://github.com/user-attachments/assets/62159338-8b26-4cb2-825d-e20965c6558d)
2025-03-10 16:09:32 +01:00
Thomas Heartman
51c9617da8
Fix: weird strategy spacing on envs without release plans (#9466)
Fixes a visual bug where envs without release plans would get too much
spacing on the top of their first strategy.

It does this flattening the list of strategies if there are no release
plans. In doing so, I have extracted the strategy list rendering into a
separate component (to make things more legible and re-usable) and have
also removed the FeatureStrategyEmpty component and marked it as
deprecated. In the new designs, you can't expand envs without
strategies, so the component is no longer needed.

Before (what looks like a shadow is actually the extra list being
rendered with a bit of padding):

![image](https://github.com/user-attachments/assets/5ba06ac9-046c-4fbd-8b46-b077b8a0570b)

After:

![image](https://github.com/user-attachments/assets/64270582-1221-4bdf-a85b-c24ce23bd4a3)
2025-03-10 14:49:26 +01:00
Thomas Heartman
220550071f
chore(1-3450): Place strategy names and titles on the same line (and fix list nesting issues) (#9443)
Moves strategy titles and names onto the same line, as per the new
designs.

In doing so, I've also updated the component to use a more semantic
hgroup with the header being the strategy title if it exists or the
strategy name if not.

The downside of being more semantically correct here is that we need to
know what header level we want the strategy to use. In most cases,
that's 3 (e.g. flag name > environment > strategy, release plan >
milestone > strategy), but for plans on flag envs, it's 4 (flag name >
env > milestone name > strategy).

I've also taken the opportunity to fix a little mistake I made earlier.
`ol`s can only have `li` children, and I'd forgotten to wrap a nested
`ol` inside an `li`. The changes in `EnvironmentAccordionBody` all
relate to that change. Because we now have several layers of lists
nested within each other, dealing with styling and padding gets a little
tricky, but CSS has the power do help us out here.

Rendered:

![image](https://github.com/user-attachments/assets/634615fe-b06d-4baa-8aa3-22447d1fb8b4)
2025-03-07 13:09:36 +01:00
Thomas Heartman
f6987909e7
Chore(1-3449): release plans in strategy env (#9441)
Use new design for release plans in flag environments.

- Move old ReleasePlanMilestone into Legacy file and update imports
- In the new version, use the same strategy list and item as in the
general strategy list and milestone template creation (components to be
extracted in the future)
- Fix an issue with the border being obscured by overflow by hiding
overflow


![image](https://github.com/user-attachments/assets/2258263d-aa96-4939-8af1-88236050cbd6)
2025-03-07 11:18:09 +01:00
Thomas Heartman
2e086161eb
refactor: strategy draggable item is now proj/env agnostic (#9411)
Updates `StrategyDraggableItem` (and `StrategyItem`) to be project/env
agnostic. They now instead expect you to pass in the required header
items (CR badges, strategy actions) at the call site. Updates their
usage in the feature env accordion, and the release plan card.

All components that have been updated are part of the new overview
rework. The legacy components (which are used when the flag is off)
remain untouched.

Also makes a few small tweaks explained in inline comments.

## Rendered 

Milestone card (with flag on):

![image](https://github.com/user-attachments/assets/828d5fe4-4b07-4ebe-86cd-1ab24608ba31)

Milestone card (with flag off):

![image](https://github.com/user-attachments/assets/10e37cc4-e5e4-4a07-a4f9-5e5f5c388915)


Feature env accordion (flag on (no change)):

![image](https://github.com/user-attachments/assets/2e5db9e7-24b1-4b3e-9434-4705e5737157)


Feature env accordion (flag off):

![image](https://github.com/user-attachments/assets/469970b6-ab57-4332-a99f-8f8e2e645230)
2025-03-05 10:34:55 +01:00
Gastón Fournier
4ae09fdb05
fix: copy strategy is allowed to copy to self (duplicate) (#9407)
When checking for permissions we were checking if the user was allowed
to copy to other environments but it can also copy to the same
environment.

Before the change: 

![image](https://github.com/user-attachments/assets/3bb1b738-8a4b-4c1b-b45f-c48895454c0a)


After the change: 

![image](https://github.com/user-attachments/assets/869e0fed-b7da-436c-93b4-fc50b6830e45)
2025-03-03 17:11:50 +01:00
Thomas Heartman
596577a1b7
feat: use new strategy list in release plans (#9405)
Here's an initial first pass of replacing the strategy lists in release
plan milestones.

The existing MilestoneCard has been moved to a Legacy file to avoid
conflicts.

This PR places the strategies in a list and changes the background color
of the list items (the strategies themselves still have a white
background, however).

It also re-orders the buttons in the footer and places the
milestone-level drag handle outside the milestone card.


![image](https://github.com/user-attachments/assets/5807bf09-ecbc-4539-a507-03482face154)

## For later

Changing out the strategy list item itself hasn't been done yet. I want
to see if we can re-use the existing strategy draggable item instead of
making a copy. There's some dependencies on project path params etc that
need to be worked out first, though, so I'd prefer to do get these
initial changes through first.
2025-03-03 13:17:55 +01:00
Tymoteusz Czech
1b67b288ee
Segment view for strategy evaluation (#9399)
Refactored "segments" part of strategy evaluation. This shows a lot of places, that use "Legacy" component.
2025-02-28 15:15:25 +01:00
Nuno Góis
8d0820fc8b
chore: release plan replacement UI (#9400) 2025-02-28 14:14:34 +01:00
Nuno Góis
da91ae6afe
chore: new add release plan dialog (#9389)
https://linear.app/unleash/issue/2-3249/adding-a-release-plan-to-a-non-cr-environment-feels-too-immediate

This adds a new confirmation / preview dialog when adding a release
plan.

What's cool about it is that it will describe what will happen before
you confirm. It also acts as the "add to CR" dialog, so we now only have
1 dialog instead of 2 separate ones.

This also refactors quite a bit of our code here, hopefully simplifying
it.

### Simple (env disabled)

![image](https://github.com/user-attachments/assets/579697a8-5b21-4400-a48b-96d2df3931f6)

### CR protected (env enabled)

![image](https://github.com/user-attachments/assets/35398bc9-faed-4ce1-8c78-52e89fe21f4a)
2025-02-28 10:57:20 +00:00
Tymoteusz Czech
a6cfcea029
refactor: new constraints style (#9363)
Refactored styles for strategy evaluation parameters. New look for constraints etc
2025-02-28 10:49:23 +01:00
Thomas Heartman
0a0d6e9e2a
refactor(1-3429): makes the drag args optional, defaulting to noops (#9394)
Removes the `() => {} as any` args from the StrategyDraggableItem
invocation when you have paginated strats. Instead makes all the drag
params optional. It defaults to a no op if not provided.

Also, the reason it had to be typed as `any` before is probably because
it was missing a function. The correct empty param is `() => () => {}` 💁
2025-02-28 08:45:01 +00:00
Thomas Heartman
63d4b8b0e4
chore: adjust env dropdown (#9382)
Adjusts styling of the env dropdown now that we have both release plans
and strategies.

Key points:
- simplifies strategy separator, removes inherent height. Also: extracts
it from the draggable component (it has no business knowing whether to
add that or not)
- Puts release plans and strategies in the same list so that it becomes:
```markdown
- Release plan
  - strategy 1
  - strategy 2
- (OR) Strategy A
- (OR) Strategy B
```
- Adjusts some padding around to make it line up properly
- Swaps a couple conditional renders for ternaries


Rendered:

![image](https://github.com/user-attachments/assets/d6d5cd56-572f-419e-90ed-6449a63fdc96)

## Still todo:

Handle cases where you have >50 strats and we show the warning etc. It's
a little trickier because of how it interacts with release plans, so I
wanna leave that for later.

I'm also unsure about how we handle spacing today. All the little items
have their own different spacing and I'm not sure it won't get out of
sync, but I'm also not sure how else to handle it. We should look at it
later.
2025-02-27 15:28:41 +01:00
Thomas Heartman
359b7cc4c0
chore: handle release plans in new strategy list (#9380)
Splits the release plan component into a Legacy component and a new one
with the initial changes for the new strategy list view.

Here's what it looks like:

![image](https://github.com/user-attachments/assets/ecca20d5-1c29-42a9-93f4-61d158ba5a76)

Notice that the background color stops a little early (before the OR
token). I'll handle that in a follow-up because the changes also impact
how the rest of the env accordion body is rendered.
2025-02-27 11:16:24 +01:00
Thomas Heartman
0c6ef912d4
chore(1-3420): wrap strategy list in an ordered list (#9377)
Improves the semantic correctness of the strategy list by wrapping it
in an `ol` tag.

Strategy order matters (due to variant resolution etc), so the order
is important (hence the `ol` instead of a `ul`).

Dragging still works and it's visually the same.
2025-02-27 08:15:08 +00:00
Thomas Heartman
e25fb9f7c0
chore(1-3389): new env strategy containers (#9361)
Updates the strategy list based on the new designs and moves the current
versions of the touched components into `Legacy...` files (the vast
majority of changes are that and updating imports). The relevant changes
to the components are listed in their original files.

Flag on:

![image](https://github.com/user-attachments/assets/cd49c283-6044-46d4-bcef-182cb6a1de4e)

Flag off:

![image](https://github.com/user-attachments/assets/7ef92b6d-31e5-4218-90b2-dedd5e6cc6de)

## Next steps

There's two items to review for improving these current comments (also
noted inline):
- Whether to aria-hide the "or" separator or not (I need to read up a
bit and think whether it makes sense to show that or not)
- Changing the list of strategies into an actual ordered list (`ol`).
That'd reflect the semantics better.

Next would be checking the other places we use strategy lists and then
updating those too. In doing so, I might find that some things need to
be updated, but I'll handle those when I get there.

There's also handling release plans.
2025-02-26 16:24:50 +01:00
Thomas Heartman
000ee66692
fix: long flag names push table to overflow and flag descriptions are not truncated (#9350)
Addresses two issues related to flag names and descriptions overflowing:

1: In the project flag overview, long flag names push the environments
off screen. This is handled by setting overflow-wrap: anywhere on the
offending text. The text will now use ellipses instead.

Before full-width: 

![image](https://github.com/user-attachments/assets/1c63481a-6733-4f6e-a3a7-46c9035c38f7)

Before narrower:

![image](https://github.com/user-attachments/assets/86cf3531-8259-42f0-9905-4a22dd7f98a7)


After full-width:

![image](https://github.com/user-attachments/assets/e13fa6ff-4cbe-4f6e-8530-b089a8343c65)

After narrower:

![image](https://github.com/user-attachments/assets/c4df0e5d-e32f-4909-9351-afc864383c7b)

2: On the flag page, long descriptions are rendered in their entirety,
even if that's not sensible. They are now truncated after five lines.
There is a tooltip that shows the full text, or you can go the flag
settings to see the full description.

Before:

![image](https://github.com/user-attachments/assets/121ffeac-b92b-4b9b-bb79-17bf5d4ef734)


After:

![image](https://github.com/user-attachments/assets/cd4ff0c2-e110-42c1-8ce6-e0e897823420)


After (with tooltip):

![image](https://github.com/user-attachments/assets/90c147e4-a397-4e60-8318-9a08c4e069aa)


---

Note, I don't think this is necessarily the perfect solution (it'd be
nice to get tooltips for overflowing flag names a "show full
description" disclosure button instead of the stupidly long tooltip),
but I think it's a step in the right direction.
2025-02-25 13:39:30 +01:00
Tymoteusz Czech
42a05ef418
feat: new environment box (#9342)
Co-authored-by: Thomas Heartman <thomas@getunleash.io>
2025-02-25 10:34:36 +00:00
David Leek
f19ffd0e7e
chore: fix small UI issues in release templates/plans (#9341) 2025-02-24 15:25:44 +01:00
Thomas Heartman
1db97882c2
feat: make env selector filterable (#9340)
Makes the env selector on the flag page act the same way as the env
selector on the new project page or any of the filterable buttons in the
new project/flag dialogs.

Also slightly changes the styles of the existing dropdown lists to bring
them in line with the new env selector (more padding, full-width
highlights).

Selector:


![image](https://github.com/user-attachments/assets/83875aa3-f9d1-4763-b8eb-75f7dc493b13)


Project/flag creation:
Before:

![image](https://github.com/user-attachments/assets/97926ec8-64a0-4d08-900b-0acd5709ef92)


After:


![image](https://github.com/user-attachments/assets/2616615f-3382-4183-a048-5ea4defc8fb2)

## Technical notes

I was a little unsure how best to share the padding/spacing styles
between the search field and popover at first (as was requested by UX).
The easiest way (and most compliant with how we do it today) was to
define the spacing in a variable and move the relevant components into
the same file.

However, I actually think that using a CSS variable (e.g.
`--popover-spacing`) would be "better" here, but we don't really use
them much, so I've left that out for now. That said, if you agree, I'd
be more than happy to use that instead 🙋🏼
2025-02-21 11:20:43 +00:00
Thomas Heartman
9b282a436d
chore: reduce tab sizes on flag page + fix wrapping/overlapping issue with action buttons (#9339)
Reduces the size of the tab buttons on the flag page:
- Sets the min width to 100px instead of 160px on md screens. No change
for smaller screens
- Removes the min-height restriction imposed by theme.ts for the tab
bar, instead relying on the tab buttons to determine the height
(effectively changes the height from 70px to 62px).

Additionally: fixes an issue where the action buttons would overlap with
the tab buttons before wrapping and makes the tab bar scrollable. I can
no longer reproduce the issue where the action buttons force the tab bar
to be too small, but even if they should do that now, the tab bar is
scrollable so the remaining tabs are still accessible.

Because we only override the tabs' min-width on wider screens and mui
sets a default min-width, I changed the `onNarrowHeader` function to
`onWideHeader` and adjusted the other components accordingly. As a
bonus, the tab width and header wrapping now happens at the same time 🥳

After the change:

![image](https://github.com/user-attachments/assets/b164cc7d-ca96-4877-b507-cec9e00a2302)


## Accessibility

This PR also addresses some of the a11y issues with this tab bar, namely
that it adds an `aria-label`, as mentioned in the [MUI
docs](https://v5.mui.com/material-ui/react-tabs/#accessibility).

It does **not**, however, connect the tabs to their corresponding tab
panels. The main reason for this is that we're not using tab panels and
that they're spread over 4 different components. We're probably using
the tabs component for something it isn't really designed to do in this
way. (Arguably they should be links and not buttons, for instance.) I'm
not going to touch this now, because that would probably be a lot of
work and it's not something I expect the business would prioritize.

## Changing theme.ts

While it's tempting to go in and change the `min-height` in `theme.ts`,
that would potentially affect all the other tab bars we have (although
maybe not, because we set a different min height for the tabs
themselves), I want to leave that for now. There is apparently some work
being done/prepared for the tabs, so it's probably better to leave that
for then.
2025-02-20 15:02:04 +01:00
Thomas Heartman
6e1f683902
chore(1-3380): handle narrow windows for the flag header. (#9321)
Makes it so that the actions/tabs wrap on narrow width screens.

Constraints:
- When wrapping, the actions should go **before** the tabs, when not
wrapping, they should be placed **after**
- Need to maintain a logical tab order for wrapping, so just using
`flex-flow: row wrap-reverse` doesn't work because the tab order will be
wrong
- When the elements switch, you shouldn't lose your tab place in the
document

This solution uses container queries to determine the container size and
uses that to set the wrapping. Falls back to media queries if container
queries aren't supported (it's supported on >93% of browsers according
to caniuse).

The wrapping points don't use predefined media queries because:
- containers don't care about the size of the screen. It's the intrinsic
size of the container that matters.
- wrapping at 900px seemed too far out if container queries are
unsupported. But it's a fallback, so we can switch to that if we want.

If your keyboard focus is on one of the actions on a wide screen, and
the screen goes narrow, your focus will still be after the tabs (staying
consistent), so tabbing to the next element will take you into the flag
details, while backtab takes you back to the tabs.


Before wrapping:

![image](https://github.com/user-attachments/assets/21557d9d-e083-4c0c-a7e5-400751fe5822)

After wrapping:

![image](https://github.com/user-attachments/assets/efc482b9-39b0-446c-8d8e-cfa551ce5edd)

## A note on accessibility:

The spec for flexbox (taken from [MDN's
doc](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_flexible_box_layout/Ordering_flex_items))
states:

> "Authors must not use order or the *-reverse values of
[flex-flow](https://developer.mozilla.org/en-US/docs/Web/CSS/flex-flow)/flex-direction
as a substitute for correct source ordering, as that can ruin the
accessibility of the document."

So even if wrap-reverse works visually, it's not a good solution for
this.
2025-02-20 09:31:08 +00:00
Tymoteusz Czech
e095411de4
feat: show add strategy button when release plan (#9329)
Should show "add strategy" for redesigned page
2025-02-19 14:22:50 +01:00
David Leek
c938b0fa6c
chore: await so change requests banner shows up after adding release plans changes (#9328) 2025-02-19 11:18:10 +01:00
Tymoteusz Czech
2a6487e7e9
feat: show and hide environments (#9323)
- Button to show and hide environments
- Refactored hook storing state of hidden environments
- Changed the way flag is triggered for feature overview
- Visual updates for new page look

---------

Co-authored-by: Thomas Heartman <thomas@getunleash.io>
2025-02-19 09:48:07 +00:00
Thomas Heartman
14b6b38238
feat(1-3379): add stale badge to the new header (#9320)
Without this, there's no way to tell if a flag is stale or not on the
flag page, so we're adding it back in. However, we'll only show the
badge if it's stale, not if it's an active flag.

Stale flag with badge:

![image](https://github.com/user-attachments/assets/eded97ab-0bba-41e5-8e1c-37cc90684c63)

When it wraps:

![image](https://github.com/user-attachments/assets/223eb672-20d2-4f3c-a5d9-34c3b739ce5e)

To make the badge line up properly when it wraps, I removed the
hard-coded margin in the badge. To counteract that, I've also removed
the hard-coded margin in the "copy name" button and switched to using
flex gaps to sort that.

It still looks right.

Before:

![image](https://github.com/user-attachments/assets/d945b067-c182-4448-967f-5505cf2e47ca)

After:

![image](https://github.com/user-attachments/assets/3b78b9fc-82b9-4d21-a53a-a3849819e916)
2025-02-18 12:34:46 +00:00
Thomas Heartman
4701dc1552
refactor: move feature overview header into separate file (#9319)
This PR moves the flag page header into a separate file, so that the
overview file is more clearly focused on the overview.

Additionally, it moves the modals that are triggered from the header
into the new file. This should give a nice little performance boost, as
opening and closing these modals should no longer trigger a re-rendering
of the full flag overview page, only the header.
2025-02-18 11:35:40 +01:00
Tymoteusz Czech
2ede2a6578
feat: new flag info box (#9308)
- updated spacing of elements
- modified header and "flag type" 
- added "collaborators"
- refactored tags

Co-authored-by: Thomas Heartman <thomas@getunleash.io>
2025-02-18 10:30:52 +01:00
Thomas Heartman
aafacc68cf
feat: new flag header (#9302)
Initial spike to add the new design for the flag page header
2025-02-14 14:33:35 +01:00
Thomas Heartman
5c23a52119
fix: add some missing button labels on the project page (#9299)
Adds aria-labels to the env visibility toggle button and the "copy
env" button.
2025-02-12 09:39:03 +01:00