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

URL bar improvements #526

Merged
merged 35 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
a66e01e
Add URL history to navigation
p-malecki Aug 30, 2024
9c787f4
Show full name of URLs in tooltips
p-malecki Aug 30, 2024
ce2dc18
Extend full name of URLs in list item instead of tooltips
p-malecki Sep 2, 2024
967644e
Upgrade spliting long url labels in URL bar
p-malecki Sep 3, 2024
def9ac1
Add recent URLs list to SelectUrl
p-malecki Sep 3, 2024
3e9f547
Add scrolling to SelectUrl
p-malecki Sep 3, 2024
20113ce
Add recent URLs list to UrlBar
p-malecki Sep 3, 2024
01aaa91
Make Select.Trigger more responsive
p-malecki Sep 4, 2024
0388d0b
Change UrlSelect style
p-malecki Sep 4, 2024
4ac59a3
Minor changes
p-malecki Sep 4, 2024
d47c878
Reformat
p-malecki Sep 4, 2024
3086be6
Move reset logic to useEffect with changing resetKey prop
p-malecki Sep 4, 2024
d6b7fe0
Refactor
p-malecki Sep 4, 2024
22c35f1
Simplify url bar css, remove splitLines
p-malecki Sep 5, 2024
0e70dbd
Change reset logic
p-malecki Sep 5, 2024
809cdce
Add params from navigationDescriptor to navigationData
p-malecki Sep 5, 2024
739dcc3
Revert "Add params from navigationDescriptor to navigationData"
p-malecki Sep 5, 2024
544e920
Add ExpoRouter to dependency checks
p-malecki Sep 6, 2024
5dd5272
Change goHome
p-malecki Sep 6, 2024
7efd05b
Fix reset logic and changing urls
p-malecki Sep 6, 2024
c003b87
Remove consol log
p-malecki Sep 6, 2024
e0e5a6d
Update NiceButton.stories.jsx
p-malecki Sep 6, 2024
476ea1b
Remove project from UrlBar props
p-malecki Sep 6, 2024
68ad7ca
Change isOptional in dependenciesProvider
p-malecki Sep 9, 2024
57ff8d3
Update packages/vscode-extension/src/dependency/DependencyManager.ts
p-malecki Sep 9, 2024
fa0a164
Simplify isExpoRouterProject
p-malecki Sep 9, 2024
663d217
Use requireNoCache in isExpoRouterProject
p-malecki Sep 9, 2024
d144cb2
Use reloadMetro in goHome for non expo-router projects
p-malecki Sep 9, 2024
33f98bc
Fix URL changes in useEffect
p-malecki Sep 9, 2024
6c51a81
Fix storing dynamic paths twice in url history on go back
p-malecki Sep 10, 2024
6972b78
Remove consol.log
p-malecki Sep 10, 2024
4ef0333
Merge branch 'main' into @p-malecki/urlbar-enhance
p-malecki Sep 11, 2024
7640e6b
Fix in expo router project detection to scan devDependencies
p-malecki Sep 11, 2024
7e89e30
Add comment to isExpoRouterProject
p-malecki Sep 11, 2024
3f7447c
Rename label in DiagnosticView
p-malecki Sep 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions packages/vscode-extension/src/dependency/DependencyManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ export class DependencyManager implements Disposable {
installed,
info: "Whether supported version of Expo Router is installed.",
error: undefined,
isOptional: !isExpoRouterProject(),
},
});
Logger.debug(`Minimum Expo version installed:`, installed);
Expand All @@ -353,6 +354,7 @@ export class DependencyManager implements Disposable {
installed,
info: "Whether Storybook is installed.",
error: undefined,
isOptional: true,
},
});
Logger.debug("Storybook installed:", installed);
Expand Down Expand Up @@ -460,3 +462,18 @@ export function checkMinDependencyVersionInstalled(dependency: string, minVersio
export async function checkAndroidEmulatorExists() {
return fs.existsSync(EMULATOR_BINARY);
}

export function isExpoRouterProject() {
try {
const appRoot = getAppRootFolder();
const packageJson = require(path.join(appRoot, "package.json"));
Copy link
Collaborator

@filip131311 filip131311 Sep 9, 2024

Choose a reason for hiding this comment

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

requireNoCache

const hasExpoRouterDependency = Object.values<string>(packageJson.dependencies).some(
(dependencies: string) => {
return dependencies.includes("expo-router");
}
);
p-malecki marked this conversation as resolved.
Show resolved Hide resolved
return hasExpoRouterDependency;
} catch (e) {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface DependencyState {
installed: InstallationStatus;
info: string;
error?: string;
isOptional?: boolean;
}

interface DependencyMessageData {
Expand All @@ -27,6 +28,7 @@ interface DependencyMessageData {
installed: boolean;
info: string;
error?: string;
isOptional?: boolean;
};
}

Expand Down Expand Up @@ -88,9 +90,17 @@ function hasError(dependencies: Dependencies, domain: "ios" | "android" | "commo

function adaptDependencyData(data: DependencyMessageData["data"]): DependencyState {
if (data.installed) {
return { ...data, installed: InstallationStatus.Installed };
return {
...data,
installed: InstallationStatus.Installed,
isOptional: data.isOptional ?? false,
};
}
return { ...data, installed: InstallationStatus.NotInstalled };
return {
...data,
installed: InstallationStatus.NotInstalled,
isOptional: data.isOptional ?? false,
};
}

function entries<K extends string, T>(object: Partial<Record<K, T>>) {
Expand Down Expand Up @@ -156,8 +166,8 @@ export default function DependenciesProvider({ children }: PropsWithChildren) {
}, []);

const updateDependency = useCallback(
(name: keyof Dependencies, newState: Partial<DependencyState>, { isOptional = false } = {}) => {
if (isOptional && newState.installed === InstallationStatus.NotInstalled) {
(name: keyof Dependencies, newState: Partial<DependencyState>) => {
if (newState.isOptional && newState.installed === InstallationStatus.NotInstalled) {
newState.installed = InstallationStatus.Optional;
}

Expand Down Expand Up @@ -208,10 +218,10 @@ export default function DependenciesProvider({ children }: PropsWithChildren) {
updateDependency("Pods", { error: undefined, installed: InstallationStatus.InProgress });
break;
case "isExpoRouterInstalled":
updateDependency("ExpoRouter", data, { isOptional: true });
updateDependency("ExpoRouter", data);
break;
case "isStorybookInstalled":
updateDependency("Storybook", data, { isOptional: true });
updateDependency("Storybook", data);
break;
}
};
Expand Down
Loading