Skip to content

Commit 4d705da

Browse files
authored
Merge branch 'main' into feat/landing-page
2 parents f1429b8 + 3c1f8fc commit 4d705da

55 files changed

Lines changed: 7551 additions & 425 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Sync gssoc approved label
2+
3+
on:
4+
pull_request_review:
5+
types: [submitted, dismissed]
6+
pull_request:
7+
types: [opened, reopened, synchronize, ready_for_review]
8+
9+
permissions:
10+
contents: read
11+
issues: write
12+
pull-requests: read
13+
14+
jobs:
15+
sync-approved-label:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Sync gssoc:approved label
19+
uses: actions/github-script@v7
20+
with:
21+
github-token: ${{ secrets.GITHUB_TOKEN }}
22+
script: |
23+
const labelName = 'gssoc:approved';
24+
const pullRequest = context.payload.pull_request || context.payload.review?.pull_request;
25+
26+
if (!pullRequest?.number) {
27+
core.info('No pull request context found.');
28+
return;
29+
}
30+
31+
const owner = context.repo.owner;
32+
const repo = context.repo.repo;
33+
const pullNumber = pullRequest.number;
34+
35+
const { data: currentPullRequest } = await github.rest.pulls.get({
36+
owner,
37+
repo,
38+
pull_number: pullNumber,
39+
});
40+
41+
const headSha = currentPullRequest.head.sha;
42+
const reviews = await github.paginate(github.rest.pulls.listReviews, {
43+
owner,
44+
repo,
45+
pull_number: pullNumber,
46+
per_page: 100,
47+
});
48+
49+
const latestReviewsByUser = new Map();
50+
51+
for (const review of reviews) {
52+
if (!review.user || review.user.type === 'Bot' || !review.submitted_at) {
53+
continue;
54+
}
55+
56+
const existing = latestReviewsByUser.get(review.user.login);
57+
const reviewTime = Date.parse(review.submitted_at);
58+
const existingTime = existing ? Date.parse(existing.submitted_at) : -1;
59+
60+
if (!existing || reviewTime >= existingTime) {
61+
latestReviewsByUser.set(review.user.login, review);
62+
}
63+
}
64+
65+
const approvedOnCurrentHead = [...latestReviewsByUser.values()].some(
66+
(review) => review.state === 'APPROVED' && review.commit_id === headSha
67+
);
68+
69+
const { data: labels } = await github.rest.issues.listLabelsOnIssue({
70+
owner,
71+
repo,
72+
issue_number: pullNumber,
73+
});
74+
75+
const hasLabel = labels.some((label) => label.name === labelName);
76+
77+
if (approvedOnCurrentHead && !hasLabel) {
78+
await github.rest.issues.addLabels({
79+
owner,
80+
repo,
81+
issue_number: pullNumber,
82+
labels: [labelName],
83+
});
84+
core.info(`Added ${labelName} to PR #${pullNumber}.`);
85+
return;
86+
}
87+
88+
if (!approvedOnCurrentHead && hasLabel) {
89+
await github.rest.issues.removeLabel({
90+
owner,
91+
repo,
92+
issue_number: pullNumber,
93+
name: labelName,
94+
});
95+
core.info(`Removed ${labelName} from PR #${pullNumber}.`);
96+
return;
97+
}
98+
99+
core.info(`No label change needed for PR #${pullNumber}.`);

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ where stories are explored through <b>mood, atmosphere, and feeling</b> instead
2121
</p>
2222

2323

24-
[🚀 Live Demo](https://bibliodrift-dm.netlify.app/) •
24+
[🚀 Live Demo](https://bibliodrift-dm.netlify.app/) (static frontend; AI/auth need a deployed backend — see [docs/contributing.md](docs/contributing.md)) •
2525
[📚 Documentation](docs/) •
2626
[🤝 Contributing](docs/contributing.md)
2727

‎add_pwa_css.py‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import glob
2+
3+
html_files = glob.glob('frontend/pages/*.html')
4+
5+
for fpath in html_files:
6+
with open(fpath, 'r', encoding='utf-8') as f:
7+
content = f.read()
8+
9+
if 'pwa.css' not in content:
10+
# add it right after style.css
11+
content = content.replace('<link rel="stylesheet" href="../css/style.css">', '<link rel="stylesheet" href="../css/style.css">\n <link rel="stylesheet" href="../css/pwa.css">')
12+
with open(fpath, 'w', encoding='utf-8') as f:
13+
f.write(content)
14+
15+
print("Added pwa.css to all pages!")

‎add_theme_css.py‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
with open('frontend/css/style.css', 'a', encoding='utf-8') as f:
2+
f.write('''
3+
/* --- Mood Sync Theme System Overrides --- */
4+
[data-theme="rainy"],
5+
[data-theme="cozy"],
6+
[data-theme="dark-academia"],
7+
[data-theme="ocean"],
8+
[data-theme="indian-authors"] {
9+
--bg-color: var(--theme-bg) !important;
10+
--text-main: var(--theme-text) !important;
11+
--text-muted: var(--theme-text-muted) !important;
12+
--input-border: var(--theme-border) !important;
13+
--book-bg: var(--theme-surface) !important;
14+
--header-bg: var(--theme-bg) !important;
15+
}
16+
17+
[data-theme="rainy"] {
18+
--accent-gold: var(--theme-accent) !important;
19+
}
20+
21+
[data-theme="cozy"] {
22+
--accent-gold: var(--theme-accent) !important;
23+
}
24+
25+
[data-theme="dark-academia"] {
26+
--accent-gold: var(--theme-accent) !important;
27+
}
28+
29+
[data-theme="ocean"] {
30+
--accent-gold: var(--theme-accent) !important;
31+
}
32+
33+
[data-theme="indian-authors"] {
34+
--accent-gold: var(--theme-accent) !important;
35+
}
36+
''')
37+
print("Appended mood theme overrides to style.css")

0 commit comments

Comments
 (0)