diff --git a/src/lib/components/code-box/code-box.svelte b/src/lib/components/code-box/code-box.svelte index 6e988c2b6..78a88a977 100644 --- a/src/lib/components/code-box/code-box.svelte +++ b/src/lib/components/code-box/code-box.svelte @@ -12,6 +12,7 @@ export let repoUrl: string; export let defaultBranch = 'main'; export let highlight: [number | null, number | null] = [null, null]; + export let ctaText: string = 'Add to your repo'; let headerElem: HTMLElement | undefined; @@ -28,10 +29,11 @@ $: displayCode = highlight.some((v) => v === null) ? sanitizedCode : insertTextAtIndices(sanitizedCode, { - [highlight[0] as number]: '', - [highlight[1] as number]: '', + [highlight[0] as number]: '', + [highlight[1] as number]: '', }); + // $: displayCode, console.log('displayCode', displayCode) let copySuccess = false; async function copyClipboard(text: string) { @@ -67,7 +69,7 @@ {#if repoUrl.includes('github')} {/if} diff --git a/src/lib/flows/claim-project-flow/steps/add-ethereum-address/add-ethereum-address.svelte b/src/lib/flows/claim-project-flow/steps/add-ethereum-address/add-ethereum-address.svelte index efdd62c8b..ca2aae515 100644 --- a/src/lib/flows/claim-project-flow/steps/add-ethereum-address/add-ethereum-address.svelte +++ b/src/lib/flows/claim-project-flow/steps/add-ethereum-address/add-ethereum-address.svelte @@ -50,6 +50,7 @@ $: description = editing ? 'To verify you are the owner of this project, please edit your FUNDING.json file with your Ethereum address to the default branch of your repository.' : 'To verify you are the owner of this project, please add a FUNDING.json file with your Ethereum address to the default branch of your repository. '; + $: codeBoxCta = editing ? 'Edit on GitHub' : undefined; async function loadFundingJson() { const { ownerName, repoName } = $context.project?.source ?? unreachable(); @@ -142,6 +143,7 @@ path="./FUNDING.json" {code} {highlight} + ctaText={codeBoxCta} /> diff --git a/src/lib/flows/claim-project-flow/steps/add-ethereum-address/drips-json-template.ts b/src/lib/flows/claim-project-flow/steps/add-ethereum-address/drips-json-template.ts index cbcc12007..3a08219ff 100644 --- a/src/lib/flows/claim-project-flow/steps/add-ethereum-address/drips-json-template.ts +++ b/src/lib/flows/claim-project-flow/steps/add-ethereum-address/drips-json-template.ts @@ -23,7 +23,7 @@ export const getChangedTemplate = ( const end = asJSON.lastIndexOf('}'); // TODO: can we make this magic string based of the actual content? const start = - end - ' "": {\n "ownedBy": ""\n }\n }\n'.length - network.length - address.length; + end - '}, "": {\n "ownedBy": ""\n }\n }\n'.length - network.length - address.length; return [asJSON, [start, end]]; };