Skip to content

Commit f28218c

Browse files
Add setting to input your own token
Also: - Update README - Use context for shared stores - Refactor loaded data usage
1 parent 3fe04e4 commit f28218c

File tree

19 files changed

+574
-121
lines changed

19 files changed

+574
-121
lines changed

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
PUBLIC_GITHUB_TOKEN=your_github_token

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ Made with SvelteKit, TailwindCSS & shadcn-svelte.
1313
- Dynamically computed badges to indicate whether a package is the Latest, a Major version, a Prerelease, or a Maintenance version
1414
- Hover popups at multiple places across the site
1515
- "What's new" banner to keep users updated about the latest changes of the website
16-
- Optional use of a GitHub token in dev mode to avoid rate limiting
16+
- Optional use of a GitHub token to avoid rate limiting…
17+
- …in dev mode in a `.env` file (see `.env.example`)
18+
- …in production by inputting it in the settings page (click the gear icon in the navbar)
1719

1820
## How does it work?
1921

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<script lang="ts">
2+
import { Dialog as DialogPrimitive } from "bits-ui";
3+
import X from "lucide-svelte/icons/x";
4+
import * as Dialog from "./index.js";
5+
import { cn, flyAndScale } from "$lib/utils.js";
6+
7+
type $$Props = DialogPrimitive.ContentProps;
8+
9+
let className: $$Props["class"] = undefined;
10+
export let transition: $$Props["transition"] = flyAndScale;
11+
export let transitionConfig: $$Props["transitionConfig"] = {
12+
duration: 200,
13+
};
14+
export { className as class };
15+
</script>
16+
17+
<Dialog.Portal>
18+
<Dialog.Overlay />
19+
<DialogPrimitive.Content
20+
{transition}
21+
{transitionConfig}
22+
class={cn(
23+
"bg-background fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border p-6 shadow-lg sm:rounded-lg md:w-full",
24+
className
25+
)}
26+
{...$$restProps}
27+
>
28+
<slot />
29+
<DialogPrimitive.Close
30+
class="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:pointer-events-none"
31+
>
32+
<X class="h-4 w-4" />
33+
<span class="sr-only">Close</span>
34+
</DialogPrimitive.Close>
35+
</DialogPrimitive.Content>
36+
</Dialog.Portal>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<script lang="ts">
2+
import { Dialog as DialogPrimitive } from "bits-ui";
3+
import { cn } from "$lib/utils.js";
4+
5+
type $$Props = DialogPrimitive.DescriptionProps;
6+
7+
let className: $$Props["class"] = undefined;
8+
export { className as class };
9+
</script>
10+
11+
<DialogPrimitive.Description
12+
class={cn("text-muted-foreground text-sm", className)}
13+
{...$$restProps}
14+
>
15+
<slot />
16+
</DialogPrimitive.Description>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<script lang="ts">
2+
import type { HTMLAttributes } from "svelte/elements";
3+
import { cn } from "$lib/utils.js";
4+
5+
type $$Props = HTMLAttributes<HTMLDivElement>;
6+
7+
let className: $$Props["class"] = undefined;
8+
export { className as class };
9+
</script>
10+
11+
<div
12+
class={cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className)}
13+
{...$$restProps}
14+
>
15+
<slot />
16+
</div>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<script lang="ts">
2+
import type { HTMLAttributes } from "svelte/elements";
3+
import { cn } from "$lib/utils.js";
4+
5+
type $$Props = HTMLAttributes<HTMLDivElement>;
6+
7+
let className: $$Props["class"] = undefined;
8+
export { className as class };
9+
</script>
10+
11+
<div class={cn("flex flex-col space-y-1.5 text-center sm:text-left", className)} {...$$restProps}>
12+
<slot />
13+
</div>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<script lang="ts">
2+
import { Dialog as DialogPrimitive } from "bits-ui";
3+
import { fade } from "svelte/transition";
4+
import { cn } from "$lib/utils.js";
5+
6+
type $$Props = DialogPrimitive.OverlayProps;
7+
8+
let className: $$Props["class"] = undefined;
9+
export let transition: $$Props["transition"] = fade;
10+
export let transitionConfig: $$Props["transitionConfig"] = {
11+
duration: 150,
12+
};
13+
export { className as class };
14+
</script>
15+
16+
<DialogPrimitive.Overlay
17+
{transition}
18+
{transitionConfig}
19+
class={cn("bg-background/80 fixed inset-0 z-50 backdrop-blur-sm", className)}
20+
{...$$restProps}
21+
/>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<script lang="ts">
2+
import { Dialog as DialogPrimitive } from "bits-ui";
3+
type $$Props = DialogPrimitive.PortalProps;
4+
</script>
5+
6+
<DialogPrimitive.Portal {...$$restProps}>
7+
<slot />
8+
</DialogPrimitive.Portal>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<script lang="ts">
2+
import { Dialog as DialogPrimitive } from "bits-ui";
3+
import { cn } from "$lib/utils.js";
4+
5+
type $$Props = DialogPrimitive.TitleProps;
6+
7+
let className: $$Props["class"] = undefined;
8+
export { className as class };
9+
</script>
10+
11+
<DialogPrimitive.Title
12+
class={cn("text-lg font-semibold leading-none tracking-tight", className)}
13+
{...$$restProps}
14+
>
15+
<slot />
16+
</DialogPrimitive.Title>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { Dialog as DialogPrimitive } from "bits-ui";
2+
3+
import Title from "./dialog-title.svelte";
4+
import Portal from "./dialog-portal.svelte";
5+
import Footer from "./dialog-footer.svelte";
6+
import Header from "./dialog-header.svelte";
7+
import Overlay from "./dialog-overlay.svelte";
8+
import Content from "./dialog-content.svelte";
9+
import Description from "./dialog-description.svelte";
10+
11+
const Root = DialogPrimitive.Root;
12+
const Trigger = DialogPrimitive.Trigger;
13+
const Close = DialogPrimitive.Close;
14+
15+
export {
16+
Root,
17+
Title,
18+
Portal,
19+
Footer,
20+
Header,
21+
Trigger,
22+
Overlay,
23+
Content,
24+
Description,
25+
Close,
26+
//
27+
Root as Dialog,
28+
Title as DialogTitle,
29+
Portal as DialogPortal,
30+
Footer as DialogFooter,
31+
Header as DialogHeader,
32+
Trigger as DialogTrigger,
33+
Overlay as DialogOverlay,
34+
Content as DialogContent,
35+
Description as DialogDescription,
36+
Close as DialogClose,
37+
};

0 commit comments

Comments
 (0)