Skip to content

Commit 2f00750

Browse files
author
Ajit Kumar
committed
fix(changelogs, fix sponsors)
1 parent 762c46d commit 2f00750

File tree

6 files changed

+54
-55
lines changed

6 files changed

+54
-55
lines changed

src/dialogs/multiPrompt.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,10 @@ export default function multiPrompt(message, inputs, help) {
7878
hide();
7979
},
8080
});
81-
const $errorMessage = tag("span", {
82-
className: "error-msg",
83-
});
84-
const $mask = tag("span", {
85-
className: "mask",
86-
});
81+
const $errorMessage = (
82+
<span className="error-msg" style={{ display: "block" }} />
83+
);
84+
const $mask = <span className="mask" />;
8785
const $promptDiv = tag("form", {
8886
action: "#",
8987
className: "prompt multi",

src/pages/about/about.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,19 @@ export default function AboutInclude() {
4545
<div className="info-item-icon">
4646
<span className="icon acode"></span>
4747
</div>
48-
<div className="info-item-text">Official webpage</div>
49-
<small>https://acode.app</small>
48+
<div className="info-item-text">
49+
Official webpage
50+
<div className="info-item-subtext">https://acode.app</div>
51+
</div>
5052
</a>
5153
<a href="https://foxbiz.io" className="info-item">
5254
<div className="info-item-icon">
5355
<span className="icon foxbiz"></span>
5456
</div>
55-
<div className="info-item-text">Foxbiz Software Pvt. Ltd.</div>
56-
<small>https://www.foxbiz.io</small>
57+
<div className="info-item-text">
58+
Foxbiz Software Pvt. Ltd.
59+
<div className="info-item-subtext">https://www.foxbiz.io</div>
60+
</div>
5761
</a>
5862
</div>
5963

src/pages/changelog/changelog.js

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ import "./style.scss";
22
import fsOperation from "fileSystem";
33
import Contextmenu from "components/contextmenu";
44
import Page from "components/page";
5+
import toast from "components/toast";
56
import Ref from "html-tag-js/ref";
67
import actionStack from "lib/actionStack";
78
import markdownIt from "markdown-it";
89
import markdownItFootnote from "markdown-it-footnote";
910
import markdownItTaskLists from "markdown-it-task-lists";
11+
import helpers from "utils/helpers";
1012

1113
export default async function Changelog() {
1214
const GITHUB_API_URL =
@@ -19,6 +21,7 @@ export default async function Changelog() {
1921
let selectedStatus = "current";
2022
const versionIndicatorRef = Ref();
2123
const versionTextRef = Ref();
24+
const body = Ref();
2225

2326
const versionSelector = (
2427
<div className="changelog-version-selector" data-action="select-version">
@@ -39,6 +42,7 @@ export default async function Changelog() {
3942
right: "5px",
4043
toggler: versionSelector,
4144
transformOrigin: "top right",
45+
onclick: menuClickHandler,
4246
innerHTML: () => {
4347
return `
4448
<li action="current">
@@ -57,10 +61,24 @@ export default async function Changelog() {
5761
},
5862
});
5963

60-
const $content = <div className="md" id="changelog"></div>;
61-
$content.innerHTML = '<div class="loading">Loading changelog...</div>';
62-
$page.content = $content;
64+
const changelogMd = await import("../../../CHANGELOG.md");
65+
66+
toast("Loading changelog...");
67+
loadVersionChangelog();
68+
body.onref = () => renderChangelog(changelogMd.default);
69+
$page.body = <div className="md" id="changelog" ref={body} />;
6370
app.append($page);
71+
helpers.showAd();
72+
73+
$page.onhide = function () {
74+
actionStack.remove("changelog");
75+
helpers.hideAd();
76+
};
77+
78+
actionStack.push({
79+
id: "changelog",
80+
action: $page.hide,
81+
});
6482

6583
async function loadLatestRelease() {
6684
try {
@@ -72,8 +90,8 @@ export default async function Changelog() {
7290
updateVersionSelector();
7391
return renderChangelog(releases.body);
7492
} catch (error) {
75-
$content.innerHTML =
76-
'<div class="error">Failed to load latest release notes</div>';
93+
toast("Failed to load latest release notes");
94+
renderChangelog(changelogMd.default);
7795
}
7896
}
7997

@@ -82,16 +100,16 @@ export default async function Changelog() {
82100
const releases = await fsOperation(GITHUB_API_URL).readFile("json");
83101
const betaRelease = releases.find((r) => r.prerelease);
84102
if (!betaRelease) {
85-
$content.innerHTML = '<div class="error">No beta release found</div>';
103+
body.content = <div className="error">No beta release found</div>;
86104
return;
87105
}
88106
selectedVersion = betaRelease.tag_name.replace("v", "");
89107
selectedStatus = "prerelease";
90108
updateVersionSelector();
91109
return renderChangelog(betaRelease.body);
92110
} catch (error) {
93-
$content.innerHTML =
94-
'<div class="error">Failed to load beta release notes</div>';
111+
toast("Failed to load beta release notes");
112+
renderChangelog(changelogMd.default);
95113
}
96114
}
97115

@@ -105,8 +123,8 @@ export default async function Changelog() {
105123
updateVersionSelector();
106124
return renderChangelog(cleanedText);
107125
} catch (error) {
108-
$content.innerHTML =
109-
'<div class="error">Failed to load full changelog</div>';
126+
toast("Failed to load full changelog");
127+
renderChangelog(changelogMd.default);
110128
}
111129
}
112130

@@ -125,8 +143,8 @@ export default async function Changelog() {
125143
return loadLatestRelease();
126144
}
127145
} catch (error) {
128-
$content.innerHTML =
129-
'<div class="error">Failed to load version changelog</div>';
146+
toast("Failed to load version changelog");
147+
renderChangelog(changelogMd.default);
130148
}
131149
}
132150

@@ -137,28 +155,24 @@ export default async function Changelog() {
137155
// Convert full PR URLs to #number format with links preserved in markdown
138156
.replace(
139157
/https:\/\/github\.com\/Acode-Foundation\/Acode\/pull\/(\d+)/g,
140-
"[#$1](https://github.com/Acode-Foundation/Acode/pull/$1)",
158+
`[#$1](${REPO_URL}/pull/$1)`,
141159
)
142160
// Convert existing #number references to links if they aren't already
143-
.replace(
144-
/(?<!\[)#(\d+)(?!\])/g,
145-
"[#$1](https://github.com/Acode-Foundation/Acode/pull/$1)",
146-
)
161+
.replace(/(?<!\[)#(\d+)(?!\])/g, `[#$1](${REPO_URL}/pull/$1)`)
147162
// Convert @username mentions to GitHub profile links
148163
.replace(/@(\w+)/g, "[@$1](https://github.com/$1)");
149164

150165
md.use(markdownItTaskLists);
151166
md.use(markdownItFootnote);
152-
const htmlContent = md.render(processedText);
153-
$content.innerHTML = htmlContent;
167+
body.innerHTML = md.render(processedText);
154168
}
155169

156170
function updateVersionSelector() {
157171
versionTextRef.textContent = selectedVersion;
158172
versionIndicatorRef.className = "status-indicator status-" + selectedStatus;
159173
}
160174

161-
versionSelectorMenu.onclick = async function (e) {
175+
async function menuClickHandler(e) {
162176
const action = e.target.closest("li")?.getAttribute("action");
163177
if (!action) return;
164178
versionSelectorMenu.hide();
@@ -177,17 +191,5 @@ export default async function Changelog() {
177191
await loadFullChangelog();
178192
break;
179193
}
180-
};
181-
182-
// Load current version changelog by default
183-
loadVersionChangelog();
184-
185-
$page.onhide = function () {
186-
actionStack.remove("changelog");
187-
};
188-
189-
actionStack.push({
190-
id: "changelog",
191-
action: $page.hide,
192-
});
194+
}
193195
}

src/pages/sponsor/sponsor.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ export default function Sponsor(onclose) {
113113
if (err !== iap.USER_CANCELED) {
114114
alert(strings.error.toUpperCase(), err);
115115
}
116+
loader.removeTitleLoader();
116117
},
117118
);
118119

@@ -251,6 +252,8 @@ async function handlePurchase(productId, title) {
251252
required: false,
252253
id: "email",
253254
type: "email",
255+
match:
256+
/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
254257
},
255258
...extraFields,
256259
{
@@ -272,15 +275,7 @@ async function handlePurchase(productId, title) {
272275

273276
localStorage.setItem(`sponsor_${productId}`, JSON.stringify(result));
274277
loader.showTitleLoader();
275-
iap.purchase(
276-
productId,
277-
() => {},
278-
(err) => {
279-
if (err !== iap.USER_CANCELED) {
280-
alert(strings.error, err);
281-
}
282-
},
283-
);
278+
iap.purchase(productId);
284279
}
285280

286281
function onlyTitle(title) {

src/pages/sponsor/style.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@
103103
}
104104

105105
.purchase-btn {
106-
background: linear-gradient(45deg, #4ecdc4, #44a08d);
107-
color: white;
106+
background: var(--button-background-color);
107+
color: var(--button-text-color);
108108
border: none;
109109
padding: 10px 20px;
110110
border-radius: 20px;

webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module.exports = (env, options) => {
88
const { mode = 'development' } = options;
99
const rules = [
1010
{
11-
test: /\.hbs$/,
11+
test: /\.(hbs|md)$/,
1212
use: ['raw-loader'],
1313
},
1414
{

0 commit comments

Comments
 (0)