diff --git a/deploy/server.ts b/deploy/server.ts
index f3d2b9d2..2b0a2d07 100644
--- a/deploy/server.ts
+++ b/deploy/server.ts
@@ -9,7 +9,7 @@ import { fetch } from 'bun';
const distDir = path.join(__dirname, 'dist');
const indexPath = path.join(distDir, 'index.html');
const baseURL = process.env.AF_BASE_URL as string;
-const defaultSite = 'https://appflowy.io';
+const defaultSite = 'https://appflowy.com';
const setOrUpdateMetaTag = ($: CheerioAPI, selector: string, attribute: string, content: string) => {
if ($(selector).length === 0) {
diff --git a/src/@types/translations/en.json b/src/@types/translations/en.json
index 179b8332..373eb4ad 100644
--- a/src/@types/translations/en.json
+++ b/src/@types/translations/en.json
@@ -2991,7 +2991,7 @@
"second": "Unlimited pages & blocks",
"three": "5 GB storage",
"four": "Intelligent search",
- "five": "20 AI responses",
+ "five": "10 AI responses",
"six": "Mobile app",
"seven": "Real-time collaboration"
},
diff --git a/src/application/session/sign_in.ts b/src/application/session/sign_in.ts
index 75892078..00a8da63 100644
--- a/src/application/session/sign_in.ts
+++ b/src/application/session/sign_in.ts
@@ -14,7 +14,7 @@ export const AUTH_CALLBACK_PATH = '/auth/callback';
export const AUTH_CALLBACK_URL = `${window.location.origin}${AUTH_CALLBACK_PATH}`;
export function withSignIn() {
- return function (
+ return function(
// eslint-disable-next-line
_target: any,
_propertyKey: string,
@@ -23,14 +23,14 @@ export function withSignIn() {
const originalMethod = descriptor.value;
// eslint-disable-next-line
- descriptor.value = async function (args: { redirectTo: string }) {
+ descriptor.value = async function(args: { redirectTo: string }) {
const redirectTo = args.redirectTo;
saveRedirectTo(redirectTo);
try {
await originalMethod.apply(this, [args]);
- } catch (e) {
+ } catch(e) {
console.error(e);
return Promise.reject(e);
}
@@ -43,8 +43,15 @@ export function withSignIn() {
export function afterAuth() {
const redirectTo = getRedirectTo();
- if (redirectTo) {
+ if(redirectTo) {
clearRedirectTo();
- window.location.href = decodeURIComponent(redirectTo);
+ const url = new URL(decodeURIComponent(redirectTo));
+ const pathname = url.pathname;
+
+ if(pathname === '/' || !pathname) {
+ url.pathname = '/app';
+ }
+
+ window.location.href = url.toString();
}
}
diff --git a/src/components/_shared/appflowy-power/AppFlowyPower.tsx b/src/components/_shared/appflowy-power/AppFlowyPower.tsx
index 22fb0c8d..195702c3 100644
--- a/src/components/_shared/appflowy-power/AppFlowyPower.tsx
+++ b/src/components/_shared/appflowy-power/AppFlowyPower.tsx
@@ -20,7 +20,7 @@ function AppFlowyPower ({
{
- window.open('https://appflowy.io', '_blank');
+ window.open('https://appflowy.com', '_blank');
}}
style={{
width,
diff --git a/src/components/_shared/help/Help.tsx b/src/components/_shared/help/Help.tsx
index 2ad0c948..f555d197 100644
--- a/src/components/_shared/help/Help.tsx
+++ b/src/components/_shared/help/Help.tsx
@@ -72,7 +72,7 @@ export default function Help () {
}
@@ -117,7 +117,7 @@ export default function Help () {
variant={'text'}
>{t('questionBubble.feedback')}
-
+
,
onClick: () => {
- window.open('https://appflowy.io/templates', '_blank');
+ window.open('https://appflowy.com/templates', '_blank');
},
},
{
diff --git a/src/components/app/SideBarBottom.tsx b/src/components/app/SideBarBottom.tsx
index f7c10d41..c5b41c01 100644
--- a/src/components/app/SideBarBottom.tsx
+++ b/src/components/app/SideBarBottom.tsx
@@ -6,7 +6,7 @@ import { useNavigate } from 'react-router-dom';
import { ReactComponent as TrashIcon } from '@/assets/trash.svg';
import { QuickNote } from '@/components/quick-note';
-function SideBarBottom () {
+function SideBarBottom() {
const { t } = useTranslation();
const navigate = useNavigate();
@@ -22,7 +22,7 @@ function SideBarBottom () {
{
- window.open('https://appflowy.io/templates', '_blank');
+ window.open(`${window.location.origin}/templates`, '_blank');
}}
>
diff --git a/src/components/app/share/TemplatePanel.tsx b/src/components/app/share/TemplatePanel.tsx
index ee00df1f..b24d5c0a 100644
--- a/src/components/app/share/TemplatePanel.tsx
+++ b/src/components/app/share/TemplatePanel.tsx
@@ -12,21 +12,21 @@ import { useTranslation } from 'react-i18next';
import { ReactComponent as DeleteIcon } from '@/assets/trash.svg';
import { ReactComponent as EditIcon } from '@/assets/edit.svg';
-function TemplatePanel ({ viewId }: { viewId: string }) {
+function TemplatePanel({ viewId }: { viewId: string }) {
const view = useAppView(viewId);
const service = useService();
const [loading, setLoading] = React.useState(false);
const [deleteModalOpen, setDeleteModalOpen] = React.useState(false);
const [template, setTemplateInfo] = React.useState();
- const loadTemplateInfo = useCallback(async () => {
- if (!service || !view?.view_id) return;
+ const loadTemplateInfo = useCallback(async() => {
+ if(!service || !view?.view_id) return;
setLoading(true);
try {
const res = await service.getTemplateById(view?.view_id);
setTemplateInfo(res);
// eslint-disable-next-line
- } catch (e: any) {
+ } catch(e: any) {
// do nothing
} finally {
setLoading(false);
@@ -38,9 +38,9 @@ function TemplatePanel ({ viewId }: { viewId: string }) {
} = useLoadPublishInfo(viewId);
const url = useMemo(() => {
- const origin = import.meta.env.AF_BASE_URL?.includes('test') ? 'https://test.appflowy.io' : 'https://appflowy.io';
+ const templateUrl = `${window.location.origin}/templates`;
- return template ? `${origin}/templates/${slugify(template.categories[0].name)}/${template.view_id}` : '';
+ return template ? `${templateUrl}/${slugify(template.categories[0].name)}/${template.view_id}` : '';
}, [template]);
useEffect(() => {
diff --git a/src/components/as-template/AsTemplate.tsx b/src/components/as-template/AsTemplate.tsx
index 62af50e5..5f914f22 100644
--- a/src/components/as-template/AsTemplate.tsx
+++ b/src/components/as-template/AsTemplate.tsx
@@ -15,7 +15,7 @@ import './template.scss';
import { slugify } from '@/components/as-template/utils';
import { ReactComponent as WebsiteIcon } from '@/assets/website.svg';
-function AsTemplate ({
+function AsTemplate({
viewName,
viewUrl,
viewId,
@@ -37,8 +37,8 @@ function AsTemplate ({
loading,
} = useLoadTemplate(viewId);
- const handleSubmit = useCallback(async (data: AsTemplateFormValue) => {
- if (!service || !selectedCreatorId || selectedCategoryIds.length === 0) return;
+ const handleSubmit = useCallback(async(data: AsTemplateFormValue) => {
+ if(!service || !selectedCreatorId || selectedCategoryIds.length === 0) return;
const formData: UploadTemplatePayload = {
...data,
view_id: viewId,
@@ -50,7 +50,7 @@ function AsTemplate ({
};
try {
- if (template) {
+ if(template) {
await service?.updateTemplate(template.view_id, formData);
} else {
await service?.createTemplate(formData);
@@ -59,7 +59,7 @@ function AsTemplate ({
await loadTemplate();
notify.success('Template saved successfully');
- } catch (error) {
+ } catch(error) {
// eslint-disable-next-line
// @ts-ignore
notify.error(error.toString());
@@ -73,7 +73,7 @@ function AsTemplate ({
}, [loadTemplate]);
useEffect(() => {
- if (!template) return;
+ if(!template) return;
setSelectedCategoryIds(template.categories.map((category) => category.id));
setSelectedCreatorId(template.creator.id);
setIsNewTemplate(template.is_new_template);
@@ -81,7 +81,7 @@ function AsTemplate ({
}, [template]);
const defaultValue = useMemo(() => {
- if (!template) return {
+ if(!template) return {
name: viewName,
description: '',
about: '',
@@ -104,10 +104,11 @@ function AsTemplate ({
startIcon={}
variant={'text'}
onClick={() => {
- const origin = import.meta.env.AF_BASE_URL?.includes('test') ? 'https://test.appflowy.io' : 'https://appflowy.io';
+ const templateUrl = `${window.location.origin}/templates`;
- window.open(`${origin}/templates/${slugify(template.categories[0].name)}/${template.view_id}`);
- }} color={'primary'}
+ window.open(`${templateUrl}/${slugify(template.categories[0].name)}/${template.view_id}`);
+ }}
+ color={'primary'}
>{t('template.viewTemplate')}}
{template &&
@@ -133,11 +136,15 @@ function AsTemplate ({
-
+
{loading ?
:
-
-
+
+
{t('template.isNewTemplate')}
{
if (isUrl) {
const isAppFlowyLinkUrl = isURL(text, {
- host_whitelist: ['localhost', 'appflowy.com', 'test.appflowy.com', 'beta.appflowy.com'],
+ host_whitelist: [window.location.hostname],
});
- console.log('isAppFlowyLinkUrl', isAppFlowyLinkUrl);
if (isAppFlowyLinkUrl) {
const url = new URL(text);
const blockId = url.searchParams.get('blockId');
diff --git a/src/components/error/NotFound.tsx b/src/components/error/NotFound.tsx
index e670eda3..c7075588 100644
--- a/src/components/error/NotFound.tsx
+++ b/src/components/error/NotFound.tsx
@@ -35,7 +35,7 @@ const NotFound = () => {