-
-
Notifications
You must be signed in to change notification settings - Fork 752
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: update build script * build: add docker sha tag * feat: display app version * feat: set theme for share page * feat: embed view * chore: publish 1.3.1-beta.0 release * chore: publish 1.3.1 release * fix: lint
- Loading branch information
1 parent
d6c2f05
commit 218ecdf
Showing
61 changed files
with
619 additions
and
489 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
apps/nextjs-app/src/features/app/blocks/share/view/EmbedFooter.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { ArrowUpRight, TeableNew } from '@teable/icons'; | ||
import Link from 'next/link'; | ||
import { useRouter } from 'next/router'; | ||
import { useTranslation } from 'next-i18next'; | ||
import { shareConfig } from '@/features/i18n/share.config'; | ||
|
||
export const EmbedFooter = ({ | ||
hideBranding, | ||
hideNewPage, | ||
}: { | ||
hideBranding?: boolean; | ||
hideNewPage?: boolean; | ||
}) => { | ||
const router = useRouter(); | ||
const { t } = useTranslation(shareConfig.i18nNamespaces); | ||
const fullPath = router.asPath; | ||
const url = new URL(fullPath, 'http://example.com'); // Use a dummy base URL | ||
url.searchParams.delete('embed'); | ||
const pathWithoutEmbed = `${url.pathname}${url.search}`; | ||
|
||
return ( | ||
<div className="flex items-center justify-between border-t px-2 py-1 text-xs"> | ||
{!hideBranding && ( | ||
<Link href="/" className="flex items-center gap-1" target="_blank"> | ||
<TeableNew className="size-4 text-black" /> | ||
Teable | ||
</Link> | ||
)} | ||
{!hideNewPage && ( | ||
<Link className="flex gap-1" href={pathWithoutEmbed} target="_blank"> | ||
<ArrowUpRight className="size-4" /> | ||
{t('share:openOnNewPage')} | ||
</Link> | ||
)} | ||
</div> | ||
); | ||
}; |
2 changes: 1 addition & 1 deletion
2
apps/nextjs-app/src/features/app/blocks/share/view/ShareView.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 10 additions & 3 deletions
13
.../blocks/share/view/component/FormView.tsx → ...ks/share/view/component/form/FormView.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,27 @@ | ||
import { useMutation } from '@tanstack/react-query'; | ||
import { shareViewFormSubmit } from '@teable/openapi'; | ||
import { useRouter } from 'next/router'; | ||
import { useContext } from 'react'; | ||
import { FormPreviewer } from '../../../view/form/components'; | ||
import { ShareViewPageContext } from '../ShareViewPageContext'; | ||
import { FormPreviewer } from '@/features/app/blocks/view/form/components'; | ||
import { ShareViewPageContext } from '../../ShareViewPageContext'; | ||
import { FormViewBase } from './FormViewBase'; | ||
|
||
export const FormView = () => { | ||
const { shareId } = useContext(ShareViewPageContext); | ||
const { mutateAsync } = useMutation({ | ||
mutationFn: shareViewFormSubmit, | ||
}); | ||
|
||
const { | ||
query: { embed }, | ||
} = useRouter(); | ||
|
||
const onSubmit = async (fields: Record<string, unknown>) => { | ||
await mutateAsync({ shareId, fields }); | ||
}; | ||
return ( | ||
<div className="flex size-full"> | ||
<FormPreviewer submit={onSubmit} /> | ||
{embed ? <FormViewBase /> : <FormPreviewer submit={onSubmit} />} | ||
</div> | ||
); | ||
}; |
11 changes: 11 additions & 0 deletions
11
apps/nextjs-app/src/features/app/blocks/share/view/component/form/FormViewBase.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { FormBody } from '@/features/app/blocks/view/form/components/FromBody'; | ||
import { EmbedFooter } from '../../EmbedFooter'; | ||
|
||
export const FormViewBase = () => { | ||
return ( | ||
<div className="flex grow flex-col border"> | ||
<FormBody className="grow overflow-auto pb-8" /> | ||
<EmbedFooter hideNewPage /> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.