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

feat: replace icons #4

Merged
merged 2 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/bundle-watch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ jobs:
- uses: actions/setup-node@v4
- uses: preactjs/compressed-size-action@v2
with:
pattern: 'out/**/*.*'
pattern: '{images,out}/**/*.*'
3 changes: 1 addition & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ jobs:
run: |
yarn jest --coverage
# - name: report
# uses: coverallsapp/github-action@v1.0.1
# uses: coverallsapp/github-action@v2
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# path-to-lcov: ./coverage/lcov.info
4 changes: 1 addition & 3 deletions images/electron.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions images/node.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 7 additions & 7 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,12 @@ function debounce<T extends AnyFunction<void>>(fn: T, wait: number) {
} as T
}

// https://icon-sets.iconify.design/devicon/
const iconMap: Record<Platform, string> = {
browser: 'images/electron.svg',
node: 'images/node.svg',
}

function setPanelTitleAndIcon(
panel: vscode.WebviewPanel,
document: vscode.TextDocument
Expand All @@ -308,15 +314,9 @@ function setPanelTitleAndIcon(
`Preview` +
(document ? ' ' + path.basename(document.uri.fsPath) : '') +
` in ${platformTitleMap[currentPlatform]}`
const iconMap = {
browser: 'electron',
node: 'node',
}
panel.iconPath = vscode.Uri.joinPath(
itsContext!.extensionUri,
`images/${
iconMap[currentPlatform as keyof typeof iconMap] ?? 'electron'
}.svg`
iconMap[currentPlatform]
)
}

Expand Down
Loading