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

Change LHN header to Expensify #18449

Merged
merged 21 commits into from
May 16, 2023
Merged

Change LHN header to Expensify #18449

merged 21 commits into from
May 16, 2023

Conversation

bondydaa
Copy link
Contributor

@bondydaa bondydaa commented May 4, 2023

Details

This updates the "header" to show Expensify per the design mocks on the linked issue.

Fixed Issues

$ #18382

Tests

LHN

  1. Sign in to new dot
  2. Confirm the top of the LHN says Expensify and not Chats and has the proper environment badge

Signin

  1. ensure you're logged out
  2. load new dot
  3. ensure the Expensify wordmark shows in green with the proper environment badge

You can test the various badges locally by editing:

const LogoComponent = logoComponents[props.environment] || AdHocLogo;
and use the constants from above: CONST.ENVIRONMENT.DEV, CONST.ENVIRONMENT.STAGING, CONST.ENVIRONMENT.PRODUCTION

  • Verify that no errors appear in the JS console

Offline tests

Nothing specific really but same it should say Expensify not Chat at top of LHN

QA Steps

LHN

  1. Sign in to new dot
  2. Confirm the top of the LHN says Expensify and not Chats and has the proper environment badge

Signin

  1. ensure you're logged out
  2. load new dot
  3. ensure the Expensify wordmark shows in green with the proper environment badge

Wash, rinse, repeat for Staging and Production

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android / native
    • Android / Chrome
    • iOS / native
    • iOS / Safari
    • MacOS / Chrome / Safari
    • MacOS / Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I verified the translation was requested/reviewed in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR author checklist, including those that don't apply to this PR.

Screenshots/Videos

Web

Dev

Signin
image
image

LHN
Screenshot 2023-05-08 at 4 08 44 PM
Screenshot 2023-05-08 at 4 08 34 PM

Staging

Signin
image
image

LHN
image

image

Production

Signin

LHN

Mobile Web - Chrome

Dev

Signin
image

LHN
Screenshot 2023-05-08 at 4 08 20 PM
Screenshot 2023-05-08 at 4 08 27 PM

Staging

Signin
image
image

LHN
image
image

Production

Signin

LHN

Mobile Web - Safari
Desktop

Dev

Signin

LHN

Staging

Signin

LHN

Production

Signin

LHN

iOS
Android

@bondydaa bondydaa requested a review from a team as a code owner May 4, 2023 21:45
@bondydaa bondydaa self-assigned this May 4, 2023
@melvin-bot melvin-bot bot requested review from cristipaval and parasharrajat and removed request for a team May 4, 2023 21:46
@melvin-bot
Copy link

melvin-bot bot commented May 4, 2023

@parasharrajat @cristipaval One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@@ -295,7 +295,7 @@ export default {
newChat: 'New chat',
newGroup: 'New group',
newRoom: 'New room',
headerChat: 'Chats',
headerChat: 'Expensify',
Copy link
Member

@parasharrajat parasharrajat May 5, 2023

Choose a reason for hiding this comment

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

let's call it headerTitle

Update: need to remove this completely.

Copy link
Member

@parasharrajat parasharrajat left a comment

Choose a reason for hiding this comment

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

@bondydaa
Copy link
Contributor Author

bondydaa commented May 5, 2023

okay if you look at these 2 commits

3b461e2
735725c

that's how I first tried to get this to work as per the thread here: https://expensify.slack.com/archives/C01GTK53T8Q/p1683315638909159

But that led to this linter error:

/Users/dbondy/Expensidev/App/src/pages/home/sidebar/SidebarLinks.js
  164:25  error  Do not pass children as props. Instead, nest children between the opening and closing tags  react/no-children-prop

So that's why I changed it and instead have a new component that is able to just render it's children.

We could also refactor Header to render it's children but that would require also updating everywhere HeaderWithCloseButton is used and I'm not sure we want to do that right now.

@bondydaa
Copy link
Contributor Author

bondydaa commented May 5, 2023

also I still can't get iOS or android to build locally so I can't test there 😢 I'll see if I can get that figured out next week but in the meantime if @parasharrajat could test and get those screen shots that'd be 💯 ❤️

@parasharrajat
Copy link
Member

parasharrajat commented May 7, 2023

I still think we can easily adjust the Header component to have an image. Here is the diff of my attempt. This won't require changing the Header usage everywhere.

diff --git a/src/components/Header.js b/src/components/Header.js
index 01752e8e07..8e7747bdb1 100644
--- a/src/components/Header.js
+++ b/src/components/Header.js
@@ -8,7 +8,7 @@ import EnvironmentBadge from './EnvironmentBadge';
 
 const propTypes = {
     /** Title of the Header */
-    title: PropTypes.string.isRequired,
+    title: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,
 
     /** Subtitle of the header */
     subtitle: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
@@ -29,9 +29,15 @@ const defaultProps = {
 const Header = props => (
     <View style={[styles.flex1, styles.flexRow]}>
         <View style={styles.mw100}>
-            <Text numberOfLines={2} style={[styles.headerText, styles.textLarge, ...props.textStyles]}>
-                {props.title}
-            </Text>
+            {_.isString(props.title)
+                ? (
+                    Boolean(props.title) && (
+                    <Text numberOfLines={2} style={[styles.headerText, styles.textLarge, ...props.textStyles]}>
+                        {props.title}
+                    </Text>
+                    )
+                )
+                : props.title}
             {/* If there's no subtitle then display a fragment to avoid an empty space which moves the main title */}
             {_.isString(props.subtitle)
                 ? Boolean(props.subtitle) && <Text style={[styles.mutedTextLabel, styles.pre]} numberOfLines={1}>{props.subtitle}</Text>
diff --git a/src/components/ImageHeader.js b/src/components/ImageHeader.js
deleted file mode 100644
index 5c82006e39..0000000000
--- a/src/components/ImageHeader.js
+++ /dev/null
@@ -1,40 +0,0 @@
-import React from 'react';
-import {View} from 'react-native';
-import PropTypes from 'prop-types';
-import _ from 'underscore';
-import styles from '../styles/styles';
-import EnvironmentBadge from './EnvironmentBadge';
-
-const propTypes = {
-    children: PropTypes.node.isRequired,
-
-    /** Subtitle of the header */
-    subtitle: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
-
-    /** Should we show the environment badge (dev/stg)?  */
-    shouldShowEnvironmentBadge: PropTypes.bool,
-};
-
-const defaultProps = {
-    shouldShowEnvironmentBadge: false,
-    subtitle: '',
-};
-const ImageHeader = props => (
-    <View style={[styles.flex1, styles.flexRow]}>
-        <View style={styles.mw100}>
-            {props.children}
-            {/* If there's no subtitle then display a fragment to avoid an empty space which moves the main title */}
-            {_.isString(props.subtitle)
-                ? Boolean(props.subtitle) && <Text style={[styles.mutedTextLabel, styles.pre]} numberOfLines={1}>{props.subtitle}</Text>
-                : props.subtitle}
-        </View>
-        {props.shouldShowEnvironmentBadge && (
-            <EnvironmentBadge />
-        )}
-    </View>
-);
-
-ImageHeader.displayName = 'ImageHeader';
-ImageHeader.propTypes = propTypes;
-ImageHeader.defaultProps = defaultProps;
-export default ImageHeader;
diff --git a/src/pages/home/sidebar/SidebarLinks.js b/src/pages/home/sidebar/SidebarLinks.js
index 57f2df7b2c..17890ca5ff 100644
--- a/src/pages/home/sidebar/SidebarLinks.js
+++ b/src/pages/home/sidebar/SidebarLinks.js
@@ -14,7 +14,7 @@ import compose from '../../../libs/compose';
 import Navigation from '../../../libs/Navigation/Navigation';
 import ROUTES from '../../../ROUTES';
 import Icon from '../../../components/Icon';
-import ImageHeader from '../../../components/ImageHeader';
+import Header from '../../../components/Header';
 import * as Expensicons from '../../../components/Icon/Expensicons';
 import AvatarWithIndicator from '../../../components/AvatarWithIndicator';
 import Tooltip from '../../../components/Tooltip';
@@ -155,13 +155,12 @@ class SidebarLinks extends React.Component {
                     ]}
                     nativeID="drag-area"
                 >
-                    <ImageHeader
-                        accessibilityLabel={"Expensify"}
+                    <Header
+                        title={<LogoWordmark width={108} fill={defaultTheme.textLight} />}
+                        accessibilityLabel="Expensify"
                         accessibilityRole="text"
                         shouldShowEnvironmentBadge
-                    >
-                        <LogoWordmark width={108} fill={defaultTheme.textLight} />
-                    </ImageHeader>
+                    />
                     <Tooltip text={this.props.translate('common.search')}>
                         <TouchableOpacity
                             accessibilityLabel={this.props.translate('sidebarScreen.buttonSearch')}

@shawnborton shawnborton self-requested a review May 8, 2023 12:42
@shawnborton
Copy link
Contributor

How about we use the wordmark logos we have that already have the staging/dev/ad hoc labels baked in? Like this from the sign in page:
image

@parasharrajat
Copy link
Member

@bondydaa Just letting you know that I will be offline after 5 hours. So let's finish this before that.

@bondydaa
Copy link
Contributor Author

bondydaa commented May 8, 2023

Ah didn't know we had those other word mark svgs can update. This component is becoming pretty specialized so I think we should leave it as it's own component then.

The header component then can have all of the extra logic for the environment variables removed.

I think it'll be unlikely we need to reuse this new component then but that's fine.

@bondydaa
Copy link
Contributor Author

bondydaa commented May 8, 2023

oh we have a wordmark component already 😅 https://github.com/Expensify/App/blob/0bc7607bf3/src/components/ExpensifyWordmark.js#L32 pretty sure I can just use that then

Copy link
Member

@parasharrajat parasharrajat left a comment

Choose a reason for hiding this comment

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

Is It ready?

@shawnborton
Copy link
Contributor

@shawnborton could use some CSS help, the production one is slightly off (a small indent to the right), I don't see any margin or padding being added so I think it might be a flexbox thing but 🤷

Is there any reason why we need to touch those images? I think you should just leave those images as they are, and then for the LHN let's just replace the word "Chats" with a wordmark SVG (which already exists in the repo) and then use CSS to style up the existing environment badges to make them appear to be smaller.

@parasharrajat
Copy link
Member

parasharrajat commented May 9, 2023

@bondydaa Let me know if you need help with anything on this. I am thinking that this issue has EC3 priority so looking forward to close this fast.

@bondydaa
Copy link
Contributor Author

bondydaa commented May 9, 2023

It seems silly to me have 2 different ways of displaying the Wordmark and environment badge: One for the sign in pages (which is a SVG with both wordmark and environment badge) and then for LHN of SVG + Environment badge component.

The way I have it avoids needing to throw a lot of custom logic into the Header component just for the LHN or avoid having 2 components that are basically the same with slightly different usages.

Are the SVG images I used the wrong font-family for the wordmark?

@parasharrajat
Copy link
Member

Ok, I took another look at the code and now I understand how it works.

Basically, we are removing the hardcoded color from the svgs and then passing it from the code. This way we can reuse the same SVG anywhere we want and change the color for it. That's why the SVG got changed.

import * as StyleUtils from '../styles/StyleUtils';
import variables from '../styles/variables';

const propTypes = {
...environmentPropTypes,
...windowDimensionsPropTypes,

/** The styles to apply for the View wrapping the svg */
containerStyles: PropTypes.arrayOf(PropTypes.object),
Copy link
Member

Choose a reason for hiding this comment

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

Please use StylePropTypes for this.

@bondydaa
Copy link
Contributor Author

bondydaa commented May 9, 2023

Alrighty fixed the proptypes, only thing is the production version of the wordmark being slightly indented... maybe it has to do with the width of the element & flexbox since when the badges are present it's aligned properly?

@parasharrajat
Copy link
Member

I think the image size is a little bit big. cc @shawnborton
image

@parasharrajat
Copy link
Member

BUG: Web: Search bar icon is not aligned right.
image

@@ -49,7 +52,9 @@ const SignInPageContent = props => (
<View style={[styles.flexGrow2, styles.mb8]}>
<SignInPageForm style={[styles.alignSelfStretch]}>
<View style={[props.isSmallScreenWidth ? styles.mb8 : styles.mb15, props.isSmallScreenWidth ? styles.alignItemsCenter : styles.alignSelfStart]}>
<ExpensifyWordmark />
<ExpensifyWordmark
containerStyles={[(props.isSmallScreenWidth && (props.environment === CONST.ENVIRONMENT.DEV || props.environment === CONST.ENVIRONMENT.STAGING)) ? styles.ml3 : {}]}
Copy link
Member

Choose a reason for hiding this comment

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

Has a lint issue. Please wrap this in next lines.

shouldShowEnvironmentBadge
textStyles={[styles.textHeadline]}
/>
<View>
Copy link
Member

Choose a reason for hiding this comment

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

Add flexRow and flex1 to fix the search icon.

@parasharrajat
Copy link
Member

parasharrajat commented May 9, 2023

Following #18449 (comment), I applied 130x30 to test and it looks like this

image

@shawnborton
Copy link
Contributor

Nice, that looks better. The idea was that the wordmark portion would be 108px wide, and then we have to account for the extra width for the versions that have badges.

@shawnborton
Copy link
Contributor

Alrighty fixed the proptypes, only thing is the production version of the wordmark being slightly indented...

Is this still happening? And can you confirm that the existing sign up page looks exactly like it does on production too?

@bondydaa
Copy link
Contributor Author

Hmm just had a thought... @parasharrajat do you want to take over this PR and get it across the finish line? There no reason to have me a be a blocker here while I'm focused on Manual Request stuff.

if so feel free to assign yourself and move me to a reviewer.

@parasharrajat
Copy link
Member

That works. but I can't push to your branch. I will have to reopen a new PR.

@bondydaa
Copy link
Contributor Author

oh hmm... wonder if we could CP the changes over or something if you give me write access to your repo/fork/branch? whatever is easiest just let me know

@bondydaa
Copy link
Contributor Author

or actually I can also just post the diff and you can git apply it too. 1 sec

@parasharrajat
Copy link
Member

New PR #18802

@parasharrajat parasharrajat mentioned this pull request May 11, 2023
55 tasks
@parasharrajat
Copy link
Member

I have made adjustments to the wordmark dimensions on the new PR and it is ready for review. We can close this PR.

@bondydaa bondydaa merged commit e91e970 into main May 16, 2023
@bondydaa bondydaa deleted the bondy-rename-lhn branch May 16, 2023 18:54
@melvin-bot
Copy link

melvin-bot bot commented May 16, 2023

@bondydaa looks like this was merged without a test passing. Please add a note explaining why this was done and remove the Emergency label if this is not an emergency.

@bondydaa
Copy link
Contributor Author

hmm weird what?

I merged #18802 not this

@parasharrajat
Copy link
Member

This happened because I used your commits and didn't replace them. So we should have closed this first before merging other.

@bondydaa
Copy link
Contributor Author

oh interesting! whoops yes I def should have closed this first 🤦

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.

3 participants