Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ jobs:
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Fetch plugins data
run: node scripts/fetchPlugins.js
- name: build
run: pnpm run build

Expand Down
20 changes: 0 additions & 20 deletions community/support.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,3 @@ Kindly note that, if you're not subscribed to the mailing list, you won't receiv
## Others

For the latest news about Apache Answer, [follow @answerdev on Twitter](https://twitter.com/answerdev) and the [official blog](/blog) on this website. You can also reach us via [Discord](https://discord.gg/a6PZZbfnFx), but due to the size of our team, we can't guarantee an instant response. Thanks for your understanding.

If you don't find what you're looking for, please use the form below to submit your request. We'll try and get back to you as soon as possible.

import HubspotForm from 'react-hubspot-form';
import Translate from '@docusaurus/Translate';
import { Spinner } from 'react-bootstrap';

<HubspotForm
portalId="23567456"
formId="784f94e6-9bfd-4f5e-aeba-5ba40563de8c"
loading={<div className='text-center'>
<Spinner animation="border" role="status" variant="secondary">
<span className="visually-hidden">
<Translate id="loading">
Loading...
</Translate>
</span>
</Spinner>
</div> }
/>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ slug: /support

# 支持

你好!欢迎使用 Apache Answer。作为一款问答平台软件,我们吸引了一群好奇并乐于助人的用户,他们总是愿意帮助解答你的疑问。
你好!欢迎使用 Apache Answer。作为一款问答平台软件,我们吸引了一群好奇并乐于助人的用户,他们总是愿意帮助解答你的疑问。

如果你在寻找答案时遇到了困难,可以查看我们的[社区](#apache-answer-meta)、[文档](/docs)、[问题](/community/issues)或者[邮件列表](#邮件列表)。如果你找到了你能回答的问题,请解答它吧!即使你的回答可能不完美,我们的志愿者也很高兴帮助你查漏补缺。

Expand All @@ -30,21 +30,3 @@ Apache Answer 本身是关于提问和解答,那么作为其官方社区, Ap
## 其他

关于 Apache Answer 的最新消息,请在公众号上关注 Answer Dev 和[官方博客](/blog)。你也可以通过 [Discord](https://discord.gg/a6PZZbfnFx) 和我们联系,但是由于团队规模限制,我们不能确保回复的即时性,感谢你的理解。

import HubspotForm from 'react-hubspot-form';
import Translate from '@docusaurus/Translate';
import { Spinner } from 'react-bootstrap';

<HubspotForm
portalId="23567456"
formId="784f94e6-9bfd-4f5e-aeba-5ba40563de8c"
loading={<div className='text-center'>
<Spinner animation="border" role="status" variant="secondary">
<span className="visually-hidden">
<Translate id="loading">
Loading...
</Translate>
</span>
</Spinner>
</div> }
/>
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
"react": "^18.0.0",
"react-bootstrap": "^2.7.4",
"react-dom": "^18.0.0",
"react-hubspot-form": "^1.3.7",
"react-share": "^4.4.1",
"react-slick": "^0.29.0",
"remark-math": "^3.0.1",
Expand Down
94 changes: 1 addition & 93 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions scripts/fetchPlugins.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
var fs = require('fs');
var path = require('path');


var url = 'https://raw.githubusercontent.com/apache/answer-plugins/main/plugins_desc.json';
var outputPath = path.join(__dirname, '../static/data/plugin.json');

function fetchPlugins() {
fetch(url)
.then(function(response) {
if (!response.ok) {
throw new Error('HTTP error! status:', response.status);
}
return response.text();
})
.then(function(data) {
fs.mkdirSync(path.dirname(outputPath), { recursive: true });
fs.writeFileSync(outputPath, data, 'utf8');
console.log('Data fetched and saved to', outputPath);
})
.catch(function (error) {
console.error('Error fetching data:', error.message);
});
}

fetchPlugins();
27 changes: 5 additions & 22 deletions src/pages/plugins.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,16 @@ import Layout from '@theme/Layout';

import HeaderSlogan from '../components/HeaderSlogan';

import pluginList from '../../static/data/plugin.json';


export default function Plugins(): JSX.Element {
const [list, setList] = useState([]);
const { i18n } = useDocusaurusContext();
const currentLang = i18n.currentLocale;
const lang = currentLang === 'en' ? 'en_US' : 'zh_CN';
const list = pluginList[lang];

useEffect(() => {
getPluginList();
}, [])

const getPluginList = async () => {
try {
const res = await fetch(
'https://raw.githubusercontent.com/apache/answer-plugins/main/plugins_desc.json'
);
const data = await res.json();

if (Array.isArray(data)) {
setList(data);
} else {
const currentLang = i18n.currentLocale;
const lang = currentLang === 'en' ? 'en_US' : currentLang.replace('-', '_');
setList(data[lang]);
}
} catch (err) {
console.error('featch plugins list error', err);
}
}
return (
<Layout
title={translate({ message: 'Plugins' })}
Expand Down
Loading