Skip to content

Commit

Permalink
feat: Add drawLink to external apps
Browse files Browse the repository at this point in the history
  • Loading branch information
RiverTwilight committed Oct 20, 2024
1 parent 0af0283 commit ca3460a
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 2.1.2 (2024)

- feat: Adjust text in the about page
- fix: Tax calculator algorithm

## 2.1.1 (2024-09-28)

Expand Down
19 changes: 19 additions & 0 deletions src/data/en-US/externalApps.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* Add a config to this file to make the external app available.
*/

const data = [
{
id: "DrawLink",
name: "DrawLink",
description: "Visualize Any Link with AI. Powered by YGeeker.",
status: "stable",
locale: "en-US",
link: "https://drawl.ink",
icon: "https://drawl.ink/ms-icon-144x144.png",
channel: "external",
platform: ["web", "ios", "android"],
},
];

module.exports = data;
12 changes: 12 additions & 0 deletions src/data/zh-CN/externalApps.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,21 @@ const data = [
channel: "external",
platform: ["web", "ios", "android"],
},
{
id: "DrawLink",
name: "DrawLink",
description: "为 URL 生成精美的卡片,由 YGeeker 出品。",
status: "stable",
locale: "zh-CN",
link: "https://drawl.ink",
icon: "https://drawl.ink/ms-icon-144x144.png",
channel: "external",
platform: ["web", "ios", "android"],
},
{
id: "imyshare",
name: "精品网站导航",
description: "",
status: "stable",
locale: "zh-CN",
link: "https://imyshare.com/?from=ygktool",
Expand Down
2 changes: 1 addition & 1 deletion src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { isCapacitor } from "@/utils/platform";
import fetch from "node-fetch";

export async function getStaticProps({ locale = defaultLocale }) {
const appData = getAllApps(true);
const appData = getAllApps(true, locale);

const dic = require("../data/i18n.json");

Expand Down
16 changes: 15 additions & 1 deletion src/utils/appData.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import matter from "gray-matter";
import externalApps from "../data/zh-CN/externalApps";
import externalApps_zhCN from "../data/zh-CN/externalApps";
import externalApps_enUS from "../data/en-US/externalApps";
import type { AppData } from "@/types/index";

const getAppConfigFile = (appId: string, locale: string): string =>
Expand Down Expand Up @@ -77,6 +78,19 @@ const getAllApps = (
})
.flat(1);

let externalApps = [];

switch (locale) {
case "zh-CN":
externalApps = externalApps_zhCN;
break;
case "en-US":
externalApps = externalApps_enUS;
break;
default:
externalApps = externalApps_zhCN;
}

return includeExternal ? [...allApps, ...externalApps] : allApps;
};

Expand Down

0 comments on commit ca3460a

Please sign in to comment.