diff --git a/README.md b/README.md
index aebb20f..f6d0494 100644
--- a/README.md
+++ b/README.md
@@ -31,3 +31,9 @@ To begin rewarding your contributors or to start earning rewards for your contri
Whether you're a maintainer looking to give back to your team, or a developer eager to contribute to open-source projects and step into the world of Web3, CommitKudos is your gateway to a more rewarding open-source ecosystem.
Together, let's build a future where open-source thrives and contributors are rewarded as they should be.
+
+## Badge
+
+Add a badge on your repository README file to encourage users to give some Kudos !
+
+[![Dynamic JSON Badge](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fapi.github.com%2Frepos%2Fzaibon%2Fcommitkudos&query=%24.name&style=flat-square&label=Give%20some%20Kudos&cacheSeconds=3600)](https://commitkudos.com/?repository=zaibon%2Fcommitkudos&contributors=5&reward=5)
diff --git a/src/lib/components/BadgeCode.svelte b/src/lib/components/BadgeCode.svelte
new file mode 100644
index 0000000..ec4a7c6
--- /dev/null
+++ b/src/lib/components/BadgeCode.svelte
@@ -0,0 +1,24 @@
+
+
+
+ HTML
+ Markdown
+
+
+ {#if tabSet === 0}
+
+ {:else if tabSet === 1}
+
+ {/if}
+
+
diff --git a/src/lib/components/BadgeForm.svelte b/src/lib/components/BadgeForm.svelte
new file mode 100644
index 0000000..b60f48b
--- /dev/null
+++ b/src/lib/components/BadgeForm.svelte
@@ -0,0 +1,73 @@
+
+
+
diff --git a/src/lib/components/BadgeGenerator.svelte b/src/lib/components/BadgeGenerator.svelte
new file mode 100644
index 0000000..548ce80
--- /dev/null
+++ b/src/lib/components/BadgeGenerator.svelte
@@ -0,0 +1,47 @@
+
+
+
+
+ (badge = e.detail)} />
+
+
+
+ {#if imageURL}
+
+
+
+ {/if}
+
+
diff --git a/src/lib/types.ts b/src/lib/types.ts
index 0ab2014..53beece 100644
--- a/src/lib/types.ts
+++ b/src/lib/types.ts
@@ -122,3 +122,17 @@ export interface Explorer {
standard: string;
icon?: string;
}
+
+export type BadgeStyle = 'flat' | 'flat-square' | 'plastic' | 'for-the-badge' | 'social';
+
+export interface Badge {
+ badgeContent: string;
+ style?: BadgeStyle;
+ logo?: string;
+ logoColor?: string;
+ label?: string;
+ labelColor?: string;
+ color?: string;
+ cacheSeconds?: number;
+ link?: string;
+}
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index 2d636a7..34ada90 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -8,23 +8,34 @@
const { debounce } = pkg;
import { getToastStore } from '@skeletonlabs/skeleton';
import type { BalanceResult } from '@socket.tech/socket-v2-sdk';
+ import { onMount } from 'svelte';
+ import { page } from '$app/stores';
import Balance from '$lib/components/Balance.svelte';
const { isConnected, chainId, getSigner } = getAccountStores();
const toastStore = getToastStore();
- let creatingLinks = false;
+ // export let data: PageData;
+ let repository: string | null = $page.url.searchParams.get('repository');
+ let contributorsNr: number | null = $page.url.searchParams.has('contributor')
+ ? parseInt($page.url.searchParams.get('contributor') ?? '0')
+ : null;
+ let rewardAmount: number | null = $page.url.searchParams.has('reward')
+ ? parseFloat($page.url.searchParams.get('reward') ?? '0')
+ : null;
- let repository: string = '';
- let contributorsNr: number | undefined;
- let rewardAmount: number | undefined;
+ let creatingLinks = false;
let top: string[] = [];
let selectedContributors: Author[] = [];
let selectedToken: BalanceResult;
let links: { link: string; txHash: string }[] = [];
const byLogin: Map = new Map();
+ onMount(() => {
+ topContributors();
+ });
+
const topContributors = debounce(async () => {
selectedContributors = [];
top = [];
@@ -132,7 +143,7 @@
});
const promises = selectedContributors.map((contributor, i) => {
const link = links[i];
- if (!contributor || !link) {
+ if (!repository || !contributor || !link) {
return;
}
const email: Email = {
diff --git a/src/routes/badges/+page.svelte b/src/routes/badges/+page.svelte
new file mode 100644
index 0000000..0e64bae
--- /dev/null
+++ b/src/routes/badges/+page.svelte
@@ -0,0 +1,8 @@
+
+
+
+
Generate your README badge
+
+