Files
edgeever/packages/shared/src/github-feedback.ts
T
tianma-if 5ec3e509dc feat: add prefilled feedback issues
Add aligned feedback entry points to web and mobile settings, opening GitHub Issues with localized system information and privacy guidance. Refs #53.
2026-07-20 05:42:27 +08:00

39 lines
942 B
TypeScript

const GITHUB_NEW_ISSUE_URL = "https://github.com/tianma-if/edgeever/issues/new";
export type GitHubFeedbackSystemInfoItem = {
label: string;
value: string;
};
export const buildGitHubFeedbackUrl = ({
contentHeading,
contentPrompt,
privacyNotice,
systemInfo,
systemInfoHeading,
systemInfoNotice,
titlePrefix,
}: {
contentHeading: string;
contentPrompt: string;
privacyNotice: string;
systemInfo: GitHubFeedbackSystemInfoItem[];
systemInfoHeading: string;
systemInfoNotice: string;
titlePrefix: string;
}) => {
const body = [
`## ${contentHeading}`,
"",
`<!-- ${contentPrompt} -->`,
"",
`## ${systemInfoHeading}`,
"",
`<!-- ${systemInfoNotice} -->`,
...systemInfo.map((item) => `- ${item.label}: ${item.value}`),
"",
`> ${privacyNotice}`,
].join("\n");
return `${GITHUB_NEW_ISSUE_URL}?title=${encodeURIComponent(titlePrefix)}&body=${encodeURIComponent(body)}`;
};