Skip to content

Commit ec00731

Browse files
authored
Add Dark mode #6
* Add Dark mode
1 parent 52c7f21 commit ec00731

File tree

16 files changed

+495
-266
lines changed

16 files changed

+495
-266
lines changed

.github/ISSUE_TEMPLATE/issue_template_bug_report.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ body:
4848
- Edge Add-on
4949
- Cloud Edition
5050
- Local Environment
51-
- Other
51+
- Other or All Environments
5252
validations:
5353
required: true
5454

@@ -69,6 +69,6 @@ body:
6969
attributes:
7070
label: Version
7171
description: Version number can be found in the top right corner starting with 'v'
72-
placeholder: 0.5.1
72+
placeholder: v0.5.1
7373
validations:
7474
required: true

.github/workflows/test-and-release.yml

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@ on:
44
push:
55
branches: [ master, main ]
66
pull_request:
7+
types: [closed]
78
branches: [ master, main ]
89

910
jobs:
1011
test:
12+
permissions:
13+
contents: read
14+
pull-requests: write
15+
1116
runs-on: ubuntu-latest
1217

1318
steps:
@@ -23,6 +28,13 @@ jobs:
2328
with:
2429
version: 8
2530

31+
- name: Setup pnpm cache
32+
uses: actions/cache@v4
33+
with:
34+
path: ~/.pnpm-store
35+
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
36+
restore-keys: ${{ runner.os }}-pnpm-
37+
2638
- name: Install dependencies
2739
run: pnpm install
2840

@@ -36,8 +48,13 @@ jobs:
3648

3749
build-and-release:
3850
needs: test
51+
permissions:
52+
contents: write
53+
3954
runs-on: ubuntu-latest
40-
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.merged == true)
55+
if: |
56+
(github.event_name == 'push' && !contains(github.event.head_commit.message, '[skip-release]')) ||
57+
(github.event_name == 'pull_request' && github.event.pull_request.merged == true && !contains(github.event.pull_request.title, '[skip-release]'))
4158
4259
steps:
4360
- uses: actions/checkout@v4
@@ -52,19 +69,32 @@ jobs:
5269
with:
5370
version: 8
5471

72+
- name: Setup pnpm cache
73+
uses: actions/cache@v4
74+
with:
75+
path: ~/.pnpm-store
76+
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
77+
restore-keys: ${{ runner.os }}-pnpm-
78+
5579
- name: Install dependencies
5680
run: pnpm install
5781

5882
- name: Build extension
5983
run: pnpm run build
60-
84+
6185
- name: Create extension archive
6286
run: |
6387
node chromePackage.js
88+
if [ ! -f extension.zip ]; then
89+
echo "Failed to create extension.zip"
90+
exit 1
91+
fi
6492
6593
# Chrome Web Store deployment
6694
- name: Submit to Chrome Web Store
67-
if: ${{ !contains(github.event.head_commit.message, '[skip-release]') && !contains(github.event.head_commit.message, '[skip-release-chrome]') }}
95+
if: |
96+
(github.event_name == 'push' && !contains(github.event.head_commit.message, '[skip-release]') && !contains(github.event.head_commit.message, '[skip-release-chrome]')) ||
97+
(github.event_name == 'pull_request' && github.event.pull_request.merged == true && !contains(github.event.pull_request.title, '[skip-release]') && !contains(github.event.pull_request.title, '[skip-release-chrome]'))
6898
run: |
6999
npx chrome-webstore-upload-cli@2 upload --source extension.zip --auto-publish
70100
env:
@@ -73,12 +103,13 @@ jobs:
73103
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
74104
REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }}
75105

76-
# Microsoft Edge Add-on deployment
106+
# Microsoft Edge Add-ons deployment
77107
- name: Submit to Microsoft Edge Add-ons
78-
if: ${{ !contains(github.event.head_commit.message, '[skip-release]') && !contains(github.event.head_commit.message, '[skip-release-edge]') }}
108+
if: |
109+
(github.event_name == 'push' && !contains(github.event.head_commit.message, '[skip-release]') && !contains(github.event.head_commit.message, '[skip-release-edge]')) ||
110+
(github.event_name == 'pull_request' && github.event.pull_request.merged == true && !contains(github.event.pull_request.title, '[skip-release]') && !contains(github.event.pull_request.title, '[skip-release-edge]'))
79111
run: |
80112
echo "Uploading package to Edge Add-ons..."
81-
# -i オプションでレスポンスヘッダーも取得しますが、出力時に秘密情報は隠します
82113
UPLOAD_RESPONSE=$(curl -s -i -w "\n%{http_code}" -X POST \
83114
-H "Authorization: ApiKey ${{ secrets.EDGE_API_KEY }}" \
84115
-H "X-ClientID: ${{ secrets.EDGE_CLIENT_ID }}" \
@@ -91,22 +122,17 @@ jobs:
91122
92123
if [ "$UPLOAD_HTTP_CODE" != "202" ]; then
93124
echo "Failed to upload package. HTTP Code: $UPLOAD_HTTP_CODE"
94-
echo "Response omitted for security reasons."
95125
exit 1
96126
fi
97127
98-
# Location ヘッダーから OPERATION_ID を抽出(改行コード除去)
99128
OPERATION_ID=$(echo "$UPLOAD_RESPONSE" | grep -i "Location:" | awk '{print $2}' | tr -d '\r')
100129
101130
if [ -z "$OPERATION_ID" ]; then
102131
echo "Failed to get operation ID from response"
103-
echo "Response omitted for security reasons."
104132
exit 1
105133
fi
106134
107135
echo "Package uploaded. Operation ID: $OPERATION_ID"
108-
109-
# アップロード完了まで待機
110136
echo "Waiting for upload to complete..."
111137
MAX_ATTEMPTS=30
112138
ATTEMPT=1
@@ -122,10 +148,8 @@ jobs:
122148
STATUS_HTTP_CODE=$(echo "$STATUS_RESPONSE" | tail -n1)
123149
STATUS_BODY=$(echo "$STATUS_RESPONSE" | sed '$d')
124150
125-
# HTTP 200 または 202 を正常なレスポンスとして扱う
126151
if [ "$STATUS_HTTP_CODE" != "200" ] && [ "$STATUS_HTTP_CODE" != "202" ]; then
127152
echo "Failed to get status. HTTP Code: $STATUS_HTTP_CODE"
128-
echo "Response omitted for security reasons."
129153
exit 1
130154
fi
131155
@@ -136,7 +160,6 @@ jobs:
136160
break
137161
elif [ "$STATUS" = "Failed" ]; then
138162
echo "Upload failed"
139-
echo "Response omitted for security reasons."
140163
exit 1
141164
fi
142165
@@ -149,7 +172,6 @@ jobs:
149172
sleep 10
150173
done
151174
152-
# サブミッションの公開
153175
echo "Publishing submission..."
154176
PUBLISH_RESPONSE=$(curl -s -w "\n%{http_code}" -X POST \
155177
-H "Authorization: ApiKey ${{ secrets.EDGE_API_KEY }}" \
@@ -159,11 +181,8 @@ jobs:
159181
https://api.addons.microsoftedge.microsoft.com/v1/products/${{ secrets.EDGE_PRODUCT_ID }}/submissions)
160182
161183
PUBLISH_HTTP_CODE=$(echo "$PUBLISH_RESPONSE" | tail -n1)
162-
PUBLISH_BODY=$(echo "$PUBLISH_RESPONSE" | sed '$d')
163-
164184
if [ "$PUBLISH_HTTP_CODE" != "202" ]; then
165185
echo "Failed to publish submission. HTTP Code: $PUBLISH_HTTP_CODE"
166-
echo "Response omitted for security reasons."
167186
exit 1
168187
fi
169188

ff-build.zip

1.05 MB
Binary file not shown.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "harlytics",
3-
"version": "0.3.2",
3+
"version": "0.4.0",
44
"private": true,
55
"scripts": {
66
"preinstall": "npx only-allow pnpm",
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
2+
<script> export let btnClass = '';
3+
import { onMount } from 'svelte';
4+
5+
let darkMode = false;
6+
7+
onMount(() => {
8+
// クライアントサイドでのみ実行
9+
if (typeof window !== 'undefined' && typeof document !== 'undefined') {
10+
darkMode = document.documentElement.classList.contains('dark');
11+
}
12+
});
13+
14+
function toggleDarkMode() {
15+
if (typeof window !== 'undefined' && typeof document !== 'undefined') {
16+
darkMode = !darkMode;
17+
18+
if (darkMode) {
19+
document.documentElement.classList.add('dark');
20+
window.localStorage.setItem('color-theme', 'dark');
21+
} else {
22+
document.documentElement.classList.remove('dark');
23+
window.localStorage.setItem('color-theme', 'light');
24+
}
25+
}
26+
}
27+
</script>
28+
29+
<button aria-label="Dark mode" type="button" class={btnClass} on:click={toggleDarkMode}>
30+
<span class="hidden dark:block">
31+
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
32+
<path d="M10 2a1 1 0 011 1v1a1 1 0 11-2 0V3a1 1 0 011-1zm4 8a4 4 0 11-8 0 4 4 0 018 0zm-.464 4.95l.707.707a1 1 0 001.414-1.414l-.707-.707a1 1 0 00-1.414 1.414zm2.12-10.607a1 1 0 010 1.414l-.706.707a1 1 0 11-1.414-1.414l.707-.707a1 1 0 011.414 0zM17 11a1 1 0 100-2h-1a1 1 0 100 2h1zm-7 4a1 1 0 011 1v1a1 1 0 11-2 0v-1a1 1 0 011-1zM5.05 6.464A1 1 0 106.465 5.05l-.708-.707a1 1 0 00-1.414 1.414l.707.707zm1.414 8.486l-.707.707a1 1 0 01-1.414-1.414l.707-.707a1 1 0 011.414 1.414zM4 11a1 1 0 100-2H3a1 1 0 000 2h1z" fill-rule="evenodd" clip-rule="evenodd"></path>
33+
</svg>
34+
</span>
35+
<span class="block dark:hidden">
36+
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
37+
<path d="M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z"></path>
38+
</svg>
39+
</span>
40+
</button>

src/lib/components/EntryCacheTable.svelte

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -318,12 +318,12 @@
318318
<div class="table-body">
319319
{#if showByPage && hasPagesInfo}
320320
{#each pages as page}
321-
<div class="page-header">
322-
<div class="flex items-center px-2 py-1 bg-gray-100">
321+
<div class="page-header bg-white dark:bg-gray-600 dark:text-gray-200">
322+
<div class="flex items-center px-2 py-1">
323323
<div class="flex-grow font-medium" title={page.title}>
324324
{truncateText(page.title, 100) || `Page ${page.id}`}
325325
<span
326-
class="text-sm text-gray-600"
326+
class="text-sm"
327327
style="display: inline-block; float:right;"
328328
>
329329
(Load: {page.pageTimings.onLoad !== null
@@ -334,7 +334,7 @@
334334
</div>
335335
</div>
336336

337-
<div class="table-header indent">
337+
<div class="table-header indent bg-white dark:bg-gray-700 dark:text-gray-300">
338338
<div class="path header-cell">Path</div>
339339
<div class="domain header-cell">Domain</div>
340340
<div class="method header-cell">Method</div>
@@ -409,7 +409,7 @@
409409
{/each}
410410
{/each}
411411
{:else}
412-
<div class="table-header">
412+
<div class="table-header bg-white dark:bg-gray-700 dark:text-gray-300">
413413
<div class="path header-cell">Path</div>
414414
<div class="domain header-cell">Domain</div>
415415
<div class="method header-cell">Method</div>
@@ -499,7 +499,7 @@
499499
display: flex;
500500
position: sticky;
501501
top: 0;
502-
background: #f2f2f2;
502+
/* background: #f2f2f2; */
503503
border-bottom: 1px solid #ccc;
504504
z-index: 1;
505505
padding: 0 0.5rem;

src/lib/components/EntryDetailTable.svelte

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -298,11 +298,11 @@
298298
{#if showByPage && hasPagesInfo}
299299
{#each pages as page}
300300
<div class="page-header">
301-
<div class="flex items-center px-2 py-1 bg-gray-100">
301+
<div class="flex items-center px-2 py-1 bg-white dark:bg-gray-600 dark:text-gray-200">
302302
<div class="flex-grow font-medium" title={page.title}>
303303
{truncateText(page.title, 100) || `Page ${page.id}`}
304304
<span
305-
class="text-sm text-gray-600"
305+
class="text-sm"
306306
style="display: inline-block; float:right;"
307307
>
308308
(Load: {page.pageTimings.onLoad !== null
@@ -313,7 +313,7 @@
313313
</div>
314314
</div>
315315

316-
<div class="table-header indent">
316+
<div class="table-header indent bg-white dark:bg-gray-700 dark:text-gray-300">
317317
<div class="path header-cell">Path</div>
318318
<div class="domain header-cell">Domain</div>
319319
<div class="method header-cell">Method</div>
@@ -382,7 +382,7 @@
382382
{/each}
383383
{/each}
384384
{:else}
385-
<div class="table-header">
385+
<div class="table-header bg-white dark:bg-gray-700 dark:text-gray-300">
386386
<div class="path header-cell">Path</div>
387387
<div class="domain header-cell">Domain</div>
388388
<div class="method header-cell">Method</div>
@@ -464,7 +464,7 @@
464464
display: flex;
465465
position: sticky;
466466
top: 0;
467-
background: #f2f2f2;
467+
/* background: #f2f2f2; */
468468
border-bottom: 1px solid #ccc;
469469
z-index: 1;
470470
padding: 0 0.5rem;

0 commit comments

Comments
 (0)