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

1.Added a regex filter for the AIX OS. 2. Added constants for the STORYBOOK_MODE 3.Removed unecessary closing of with or '||' operator #6635

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

mortale2004
Copy link

@mortale2004 mortale2004 commented Apr 9, 2024

  1. Added a regex filter for the AIX OS.

  • This os was missing in the given regex for finding the current os of the user.
  • This regex will help to find out the current os by using switch case .
  1. Added constants for the STORYBOOK_MODE

  • The constants will prevent from typos and we can change the value of it from single place.
  1. Removed unecessary closing of
    with or '||' operator.

  • This can give error in the css styling and unecessary use of or '||' operator.

@mortale2004 mortale2004 requested a review from a team as a code owner April 9, 2024 21:18
Copy link

vercel bot commented Apr 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nodejs-org ✅ Ready (Inspect) Visit Preview Apr 10, 2024 2:06pm

@ovflowd
Copy link
Member

ovflowd commented Apr 9, 2024

I don't think people download Node for AIX within AIX. It is the sort of enterprise OS that system administrators would connect remotely no?

cc @mhdawson

@mortale2004
Copy link
Author

I don't think people download Node for AIX within AIX. It is the sort of enterprise OS that system administrators would connect remotely no?

cc @mhdawson

But there can be possibility of downloading node js on the AIX OS. If this case is not going to occur then we should remove the AIX os from the switch case also isn't it?

@ovflowd
Copy link
Member

ovflowd commented Apr 9, 2024

I don't think people download Node for AIX within AIX. It is the sort of enterprise OS that system administrators would connect remotely no?

cc @mhdawson

But there can be possibility of downloading node js on the AIX OS. If this case is not going to occur then we should remove the AIX os from the switch case also isn't it?

Are you sure AIX is part of the user agent for browsers running on AIX? Is there even any modern browser running on AIX?

Do you have example user agents?

@ovflowd
Copy link
Member

ovflowd commented Apr 9, 2024

I don't think people download Node for AIX within AIX. It is the sort of enterprise OS that system administrators would connect remotely no?

cc @mhdawson

But there can be possibility of downloading node js on the AIX OS. If this case is not going to occur then we should remove the AIX os from the switch case also isn't it?

The reason why AIX is on the switch is so people can download Node for AIX. Auto detection is just a sugar on the top, that we do for OSs that we know people open on the browser to download Node.

@mortale2004
Copy link
Author

I don't think people download Node for AIX within AIX. It is the sort of enterprise OS that system administrators would connect remotely no?

cc @mhdawson

But there can be possibility of downloading node js on the AIX OS. If this case is not going to occur then we should remove the AIX os from the switch case also isn't it?

The reason why AIX is on the switch is so people can download Node for AIX. Auto detection is just a sugar on the top, that we do for OSs that we know people open on the browser to download Node.

In the code that i have made changes. We are just getting the constant name for the Operating Systems from the user agent of the browser and this can be used to give the Node js according to the OS of its system. This is just for the easy accessibility to download Node js.

@ovflowd
Copy link
Member

ovflowd commented Apr 9, 2024

I don't think people download Node for AIX within AIX. It is the sort of enterprise OS that system administrators would connect remotely no?

cc @mhdawson

But there can be possibility of downloading node js on the AIX OS. If this case is not going to occur then we should remove the AIX os from the switch case also isn't it?

The reason why AIX is on the switch is so people can download Node for AIX. Auto detection is just a sugar on the top, that we do for OSs that we know people open on the browser to download Node.

In the code that i have made changes. We are just getting the constant name for the Operating Systems from the user agent of the browser and this can be used to give the Node js according to the OS of its system. This is just for the easy accessibility to download Node js.

You haven't answered my question. Is there any real user agent out there that contains "AIX"?

What is the point of adding AIX to the user agent query if there aren't any browser user agents with AIX within the user agent string?

Copy link
Member

@ovflowd ovflowd left a comment

Choose a reason for hiding this comment

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

But anyhow, the changes make sense at least in order to make the switch statement work. Although I dont think we should have AIX there to begin with. (In the OS detection, but I might be wrong tho!)

Thanks for the quick fix, appreciate the time you put into this. Ill check with @mhdawson regarding if AIX os detection is intended or not 🤔

@mortale2004
Copy link
Author

I don't think people download Node for AIX within AIX. It is the sort of enterprise OS that system administrators would connect remotely no?

cc @mhdawson

But there can be possibility of downloading node js on the AIX OS. If this case is not going to occur then we should remove the AIX os from the switch case also isn't it?

The reason why AIX is on the switch is so people can download Node for AIX. Auto detection is just a sugar on the top, that we do for OSs that we know people open on the browser to download Node.

In the code that i have made changes. We are just getting the constant name for the Operating Systems from the user agent of the browser and this can be used to give the Node js according to the OS of its system. This is just for the easy accessibility to download Node js.

You haven't answered my question. Is there any real user agent out there that contains "AIX"?

What is the point of adding AIX to the user agent query if there aren't any browser user agents with AIX within the user agent string?

Yes, you are right currently there is no any user agent specifiec to the AIX OS but in future it can come. Because AIX is also a popular OS.

…ng or div and or '||' operator from withSidebarCrossLinks.tsx
Copy link
Author

@mortale2004 mortale2004 left a comment

Choose a reason for hiding this comment

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

  1. Added Filter for AIX OS
  2. Used Constants for theme of STORY_BOOK
  3. Removed Extra closing of

@mortale2004 mortale2004 changed the title Add Missing OS value in the Regex for handling it in switch case statement for getting current OS of user. 1.Added a regex filter for the AIX OS. 2. Added constants for the STORYBOOK_MODE 3.Removed unecessary closing of with or '||' operator. Apr 9, 2024
@mortale2004 mortale2004 changed the title 1.Added a regex filter for the AIX OS. 2. Added constants for the STORYBOOK_MODE 3.Removed unecessary closing of with or '||' operator. 1.Added a regex filter for the AIX OS. 2. Added constants for the STORYBOOK_MODE 3.Removed unecessary closing of with or '||' operator Apr 10, 2024
@ovflowd
Copy link
Member

ovflowd commented Apr 10, 2024

I see unrelated changes on this PR from the last time Ive approved the PR 🤔

Would you mind putting those changes on another PR as they are unrelated?

@mortale2004
Copy link
Author

I see unrelated changes on this PR from the last time Ive approved the PR 🤔

Would you mind putting those changes on another PR as they are unrelated?

Okay I will do that just tell me when this PR will be merged?

@ovflowd
Copy link
Member

ovflowd commented Apr 10, 2024

It is written on the CONTRIBUTING.md file, but in general changes require 48h to get merged, but since the original change is simple I can "fast track" this PR which would allow me to merge it immediately

@mortale2004
Copy link
Author

It is written on the CONTRIBUTING.md file, but in general changes require 48h to get merged, but since the original change is simple I can "fast track" this PR which would allow me to merge it immediately

Is there need to create different PR for the other commit becuase I have added that all issues commited in the Description of this PR.

@ovflowd
Copy link
Member

ovflowd commented Apr 10, 2024

It is written on the CONTRIBUTING.md file, but in general changes require 48h to get merged, but since the original change is simple I can "fast track" this PR which would allow me to merge it immediately

Is there need to create different PR for the other commit becuase I have added that all issues commited in the Description of this PR.

Unfortunately, yes. I can re review this PR with the new changes but with the new changes this PR is not eligible anymore to be fast tracked and it might take time to be reviewed.

@mortale2004
Copy link
Author

mortale2004 commented Apr 10, 2024 via email

@mhdawson
Copy link
Member

I read this as indicating its unlikely people will be using a brower on AIX to directly access the site- https://www.ibm.com/support/pages/ibm-aix-firefox-web-browser-faq. Instead most likely they will download from another system and transfer to the AIX server.

I'm ok with the autodetection but agree we are likely ok without it.

@mortale2004
Copy link
Author

I read this as indicating its unlikely people will be using a brower on AIX to directly access the site- https://www.ibm.com/support/pages/ibm-aix-firefox-web-browser-faq. Instead most likely they will download from another system and transfer to the AIX server.

I'm ok with the autodetection but agree we are likely ok without it.

If you are Ok without autodetection then there is no need to keep AIX in the switch case for the detection of OS. It will won't work in any case because there is no any browser agent for the AIX OS.

@ovflowd
Copy link
Member

ovflowd commented Apr 15, 2024

@mortale2004 @mhdawson how y'all want to proceed?

@mhdawson
Copy link
Member

I'd just leave out the autodection for AIX.

@mortale2004
Copy link
Author

mortale2004 commented Apr 15, 2024 via email

@@ -25,13 +25,13 @@ const WithSidebarCrossLinks: FC<WithCrossLinksProps> = ({ navKey }) => {

return (
<div className="mt-4 grid w-full grid-cols-2 gap-4 xs:grid-cols-1">
{(previousCrossLink && (
{previousCrossLink && (
Copy link
Member

Choose a reason for hiding this comment

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

Afaik the div element is intentional, otherwise the nextCrossLink goes to the left, instead of staying in the right 😅

@@ -1,7 +1,7 @@
import type { UserOS } from '@/types/userOS';

export const detectOsInUserAgent = (userAgent: string | undefined): UserOS => {
const osMatch = userAgent?.match(/(Win|Mac|Linux)/);
const osMatch = userAgent?.match(/(Win|Mac|Linux|AIX)/);
Copy link
Member

Choose a reason for hiding this comment

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

I think as mentioned before, instead of adding AIX to this match, we should remove the "case AIX"

@@ -4,6 +4,7 @@ import { useLocale } from 'next-intl';
import { useTheme } from 'next-themes';
import type { FC } from 'react';

import { STORYBOOK_MODE_THEME } from '@/.storybook/constants';
Copy link
Member

Choose a reason for hiding this comment

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

As mentioned before, we shouldn't have Sotrybook constants being imported in Application code, you can create a new constant similar to the Storybook one, on an App constants file, like next.constants.mjs

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.

None yet

4 participants