Skip to content

Commit

Permalink
Mobile share_target: move to /launch
Browse files Browse the repository at this point in the history
  • Loading branch information
enricoros committed Oct 16, 2023
1 parent 9a851e3 commit 85562b5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
21 changes: 14 additions & 7 deletions pages/share.tsx → pages/launch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ import { AppLayout } from '~/common/layout/AppLayout';
import { asValidURL } from '~/common/util/urlUtils';


function LogoProgress(props: {
showProgress: boolean
}) {
function LogoProgress(props: { showProgress: boolean }) {
return <Box sx={{
width: 64,
height: 64,
Expand All @@ -30,7 +28,16 @@ function LogoProgress(props: {
}


function AppShare() {
/**
* This page will be invoked on mobile when sharing Text/URLs/Files from other APPs
* See the /public/manifest.json for how this is configured. Parameters:
* - text: the text to share
* - url: the URL to share
* - if the URL is a valid URL, it will be downloaded and the content will be shared
* - if the URL is not a valid URL, it will be shared as text
* - title: the title of the shared content
*/
function AppShareTarget() {
// state
const [errorMessage, setErrorMessage] = React.useState<string | null>(null);
const [intentText, setIntentText] = React.useState<string | null>(null);
Expand Down Expand Up @@ -140,12 +147,12 @@ function AppShare() {

/**
* This page will be invoked on mobile when sharing Text/URLs/Files from other APPs
* Example URL: https://get.big-agi.com/share?title=This+Title&text=https%3A%2F%2Fexample.com%2Fapp%2Fpath
* Example URL: https://get.big-agi.com/launch?title=This+Title&text=https%3A%2F%2Fexample.com%2Fapp%2Fpath
*/
export default function SharePage() {
export default function LaunchPage() {
return (
<AppLayout>
<AppShare />
<AppShareTarget />
</AppLayout>
);
}
2 changes: 1 addition & 1 deletion public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
}
],
"share_target": {
"action": "/share",
"action": "/launch",
"method": "GET",
"enctype": "application/x-www-form-urlencoded",
"params": {
Expand Down
2 changes: 1 addition & 1 deletion src/apps/chat/components/composer/Composer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export function Composer(props: {
}, shallow);
const { chatLLMId, chatLLM } = useChatLLM();

// Effect: load initial text if queued up (e.g. by /share)
// Effect: load initial text if queued up (e.g. by /launch)
React.useEffect(() => {
if (startupText) {
setStartupText(null);
Expand Down
6 changes: 1 addition & 5 deletions src/common/layout/AppBarSwitcherItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { setLayoutMenuAnchor } from './store-applayout';

// routes for the quick switcher menu item

type ContainedAppType = 'chat' | /*'data' |*/ 'news' /*| 'share'*/;
type ContainedAppType = 'chat' | /*'data' |*/ 'news';

const AppItems: ContainedAppType[] = ['chat', 'news'];

Expand All @@ -25,10 +25,6 @@ const AppRouteMap: { [key in ContainedAppType]: { name: string, route: string }
// name: 'Data',
// route: '/data',
// },
// 'share': {
// name: 'Share',
// route: '/share',
// },
'news': {
name: 'News',
route: '/news',
Expand Down

1 comment on commit 85562b5

@vercel
Copy link

@vercel vercel bot commented on 85562b5 Oct 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

big-agi – ./

get.big-agi.com
big-agi-git-main-enricoros.vercel.app
big-agi-enricoros.vercel.app

Please sign in to comment.