1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-19 00:15:43 +01:00
unleash.unleash/frontend
Thomas Heartman c4fa86b1aa
chore: make playground code editor height dynamic (#9271)
The playground code editor had a fixed height of `150px`. This works
well with the current font size, but if we're changing it, we'll end
up with too much height compared to the font size.

So instead, let's calculate the font size based on the current font
size.

Before this change (if you shrink font size):

![image](https://github.com/user-attachments/assets/cd6a5cc7-c5dc-421e-a34b-456cb1c318c7)

After this change:
 

![image](https://github.com/user-attachments/assets/b38cbc3d-7687-485f-8c36-244636b56f46)


It still looks the same with the old font size:

![image](https://github.com/user-attachments/assets/54cb69b3-4039-4422-9034-594aebc5a523)


Furthermore, this change uses `minHeight` instead of `height`, so that
if you have more JSON data, then you won't be stuck scrolling through 6
and 6 lines.

Before with lots of json:

![image](https://github.com/user-attachments/assets/8234fcd6-342c-44e7-a900-9893905c6191)


After with lots of json:

![image](https://github.com/user-attachments/assets/d77ee654-dfa5-4932-b0ed-0e6a39ca0b96)


And yes, the button doesn't respect the font size, but that's a
different task.
2025-02-10 12:36:16 +00:00
..
.yarn/releases chore(deps): update yarn to v4.6.0 (#9248) 2025-02-06 18:49:16 +00:00
cypress fix: e2e cypress create flag delay (#8968) 2024-12-12 13:43:01 +01:00
public
scripts
src chore: make playground code editor height dynamic (#9271) 2025-02-10 12:36:16 +00:00
.editorconfig
.gitignore chore: Add Thomas's weird files to .gitignore (#8872) 2024-11-27 16:53:33 +01:00
.npmignore
.nvmrc
.yarnrc.yml chore(deps): update yarn to v4.6.0 (#9248) 2025-02-06 18:49:16 +00:00
check-imports.rc
cypress.config.ts
cypress.d.ts
index.html
index.js
orval.config.js
package.json chore(deps): update yarn to v4.6.0 (#9248) 2025-02-06 18:49:16 +00:00
README.md
tsconfig.json
tsconfig.node.json
vercel.json
vite.config.mts fix: active flags double stale flags (#8673) 2024-11-06 15:04:07 +02:00
yarn.lock chore(deps): update testing-library monorepo (#9247) 2025-02-06 18:46:58 +00:00

frontend

This directory contains the Unleash Admin UI frontend app.

Run with a local instance of the unleash-api

Refer to the Contributing to Unleash guide for instructions. The frontend dev server runs (in port 3000) simultaneously with the backend dev server (in port 4242):

yarn install
yarn dev

Run with a sandbox instance of the Unleash API

Alternatively, instead of running unleash-api on localhost, you can use a remote instance:

cd ./frontend
yarn install
yarn run start:sandbox

Running end-to-end tests

We have a set of Cypress tests that run on the build before a PR can be merged so it's important that you check these yourself before submitting a PR. On the server the tests will run against the deployed Heroku app so this is what you probably want to test against:

yarn run start:sandbox

In a different shell, you can run the tests themselves:

yarn run e2e:heroku

If you need to test against patches against a local server instance, you'll need to run that, and then run the end to end tests using:

yarn run e2e

You may also need to test that a feature works against the enterprise version of unleash. Assuming the Heroku instance is still running, this can be done by:

yarn run start:enterprise
yarn run e2e

Generating the OpenAPI client

The frontend uses an OpenAPI client generated from the backend's OpenAPI spec. Whenever there are changes to the backend API, the client should be regenerated:

For now we only use generated types (src/openapi/models). We will use methods (src/openapi/apis) for new features soon.

yarn gen:api
rm -rf src/openapi/apis

clean up src/openapi/index.ts imports, only keep first line export * from './models';

This script assumes that you have a running instance of the enterprise backend at http://localhost:4242. The new OpenAPI client will be generated from the runtime schema of this instance. The target URL can be changed by setting the UNLEASH_OPENAPI_URL env var.

Analyzing bundle size

npx vite-bundle-visualizer in the root of the frontend directory