Add Button to Expand or Collapse Left Panel

Summary:
- Add `show more` and `show less` button to expand and collapse
- The element to show depends on its usage rank from Flipper dashboard (manually copied)

Reviewed By: danielbuechele

Differential Revision: D16917952

fbshipit-source-id: fc37d5c640be33794694e302341fa08849b8f97f
This commit is contained in:
Chaiwat Ekkaewnumchai
2019-08-21 08:48:25 -07:00
committed by Facebook Github Bot
parent d1b17d3ecd
commit afd7634fd6
4 changed files with 86 additions and 1 deletions

View File

@@ -92,6 +92,10 @@ export type Action =
| {
type: 'CLIENT_SETUP_ERROR';
payload: {client: UninitializedClient; error: Error};
}
| {
type: 'CLIENT_SHOW_MORE_OR_LESS';
payload: string;
};
const DEFAULT_PLUGIN = 'DeviceLogs';
@@ -336,6 +340,19 @@ const reducer = (state: State = INITAL_STATE, action: Action): State => {
error: `Client setup error: ${errorMessage}`,
};
}
case 'CLIENT_SHOW_MORE_OR_LESS': {
const {payload} = action;
return {
...state,
clients: state.clients.map((client: Client) => {
if (client.id === payload) {
client.showAllPlugins = !client.showAllPlugins;
}
return client;
}),
};
}
default:
return state;
}
@@ -382,6 +399,11 @@ export const selectPlugin = (payload: {
payload,
});
export const showMoreOrLessPlugins = (payload: string): Action => ({
type: 'CLIENT_SHOW_MORE_OR_LESS',
payload,
});
export const userPreferredPlugin = (payload: string): Action => ({
type: 'SELECT_USER_PREFERRED_PLUGIN',
payload,