chenos b359f9eac6
feat: supports subdirectory deployment (#3731)
* feat: supports subdirectory deployment

* feat: auto publicPath

* fix: buildIndexHtml

* fix: format

* fix: regexp

* fix: test error

* fix: nocobase.conf

* fix: path

* fix: nocobase.conf

* fix: bugs

* fix: resourcer prefix

* fix: cas
2024-03-16 20:01:34 +08:00

33 lines
835 B
TypeScript

import { SchemaComponent, useApp, useRecord } from '@nocobase/client';
import { Card } from 'antd';
import React from 'react';
import { schema } from './settings/schemas/applications';
import { usePluginUtils } from './utils';
const useLink = () => {
const record = useRecord();
const app = useApp();
if (record.options?.standaloneDeployment && record.cname) {
return `//${record.cname}`;
}
return app.getRouteUrl(`/apps/${record.name}/admin/`);
};
const AppVisitor = () => {
const { t } = usePluginUtils();
const link = useLink();
return (
<a href={link} target={'_blank'} rel="noreferrer">
{t('View', { ns: 'client' })}
</a>
);
};
export const AppManager = () => {
return (
<Card bordered={false}>
<SchemaComponent schema={schema} components={{ AppVisitor }} />
</Card>
);
};