Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ej/settings menu #732

Merged
merged 20 commits into from
Jul 19, 2023
Merged

Ej/settings menu #732

merged 20 commits into from
Jul 19, 2023

Conversation

lightlii
Copy link
Contributor

First time contributor checklist:

Contributor checklist:

  • My contribution is not related to translations. Please submit translation changes via our Mapeo Crowdin project
  • My commits are in nice logical chunks with good commit messages
  • I have walked through the QA Manual Testing
    Script
    and updated it if necessary.
  • If my changes depend upon an update to a dependency, I have updated the package-lock.json file using npm install --package-lock
  • My changes have been tested with the mobile app.
  • My changes are ready to be shipped to users on Windows, Mac, and Linux using the production version of the application built with electron-builder.

Description

closes #728

Adds a Settings menu to main layout tabs and an About Mapeo submenu.

Note: currently contains a test item on the main settings menu to indicate layout when more than one item present. Will remove before PR gets merged.

Preview

image

@lightlii lightlii requested review from achou11 and ErikSin June 29, 2023 15:13
@ErikSin
Copy link
Contributor

ErikSin commented Jun 29, 2023

Im not really sure what is going on but some of your changes are not showing up (eg. home.js).

Maybe try closing and re-opening this PR

@lightlii
Copy link
Contributor Author

lightlii commented Jul 3, 2023

I think you should be able to see the changes now @ErikSin ?

@lightlii
Copy link
Contributor Author

lightlii commented Jul 3, 2023

Basically it's because git tracks commits and so despite reverting those commits they were technically already in master. Solution was revert the reverts 🙃

https://stackoverflow.com/a/64395998/6028893

@ErikSin
Copy link
Contributor

ErikSin commented Jul 3, 2023

The setting tab should not have the red bar, and the line on the right should go all the way to the bottom (not just the existing menu items)
image

Copy link
Contributor

@ErikSin ErikSin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are using JSdoc to leverage typescript typesafety. Before we can merge this, we need to refactor the code to use that please!

src/renderer/components/SettingsView/index.js Outdated Show resolved Hide resolved
src/renderer/components/Home.js Outdated Show resolved Hide resolved
src/renderer/components/Home.js Outdated Show resolved Hide resolved
src/renderer/components/SettingsView/AboutMapeo.js Outdated Show resolved Hide resolved
src/renderer/components/SettingsView/SettingsMenu.js Outdated Show resolved Hide resolved
src/renderer/components/SettingsView/SettingsMenu.js Outdated Show resolved Hide resolved
]

export const SettingsView = () => {
const [menuItem, setMenuItem] = useState(null)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Define this useState so it is not type any

The easiest way to do this in JSDOC is to set an initial state as a variable using jsdoc:

/** @type {tabs['tabId'] | null} */
  const initialMenuState = /** {const} */ (null)
  const [menuItem, setMenuItem] = useState(initialMenuState)

You will need to define tabs with @typedef.

src/renderer/components/SettingsView/index.js Outdated Show resolved Hide resolved
src/renderer/components/SettingsView/SettingsMenu.js Outdated Show resolved Hide resolved
src/renderer/components/SettingsView/SettingsMenu.js Outdated Show resolved Hide resolved
@lightlii
Copy link
Contributor Author

lightlii commented Jul 4, 2023

aaah I hadn't seen but the merge has wrecked the code, gotta love git sometimes 🥲

@ErikSin
Copy link
Contributor

ErikSin commented Jul 4, 2023

Can you extend the menu content to be full screen?
image

@lightlii lightlii requested a review from ErikSin July 12, 2023 14:41
Copy link
Contributor

@ErikSin ErikSin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just add those typesafe changes, and then check to make sure it is working and then it can be merged

src/renderer/components/SettingsView/SettingsMenu.js Outdated Show resolved Hide resolved
aboutMapeoSubtitle: 'Version and build number'
})

const tabs = /** @typedef {const} */ [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And then we want to define this as

/** @type {import('./SettingsMenu')tab[]} */

This means tabId can only equal the tabs that we set, instead of a generic string

src/renderer/components/SettingsView/index.js Outdated Show resolved Hide resolved
@lightlii
Copy link
Contributor Author

I think this is ready to go, just before I merge just wanted to confirm that this is merging into master.. is that correct? @ErikSin

@ErikSin ErikSin merged commit 97994d6 into master Jul 19, 2023
9 checks passed
@ErikSin ErikSin deleted the ej/settings-menu branch July 19, 2023 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setting Menu
2 participants