diff --git a/website/apps/main.js b/website/apps/main.js index a6b0c23..87c64b3 100644 --- a/website/apps/main.js +++ b/website/apps/main.js @@ -18,6 +18,7 @@ dayjs.extend(dayjs_plugin_localizedFormat); // without a trailing slash const xdcget_export = "https://apps.testrun.org"; +const tryItBaseUrl = "https://webxdc-try-it.xyz"; /* Each is implemented as a button that, when clicked, would show @@ -67,6 +68,27 @@ const Dialog = ({app, modal, toggleModal}) => { size = `${(app.size/1000000).toLocaleString(undefined, {maximumFractionDigits: 1})} mb`; } + const tryItUrl = useMemo(() => { + if (!location.search.includes('tryIt')) { + return null; + } + + const url = new URL(tryItBaseUrl); + url.hostname = + "webapp-" + + app.app_id + + "-" + + app.tag_name.replaceAll(".", "-") + + "." + + url.hostname; + const params = new URLSearchParams({ + url: xdcget_export + "/" + app.cache_relname, + }); + url.hash = params.toString(); + + return url.toString(); + }, [app.app_id, app.cache_relname, app.tag_name]); + return html` toggleModal(false)} closedby="any" aria-labelledby="${app.app_id}_label" aria-describedby="${app.app_id}_desc">
@@ -97,6 +119,7 @@ const Dialog = ({app, modal, toggleModal}) => { Add to Chat + ${tryItUrl && html`Try it`}