Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Added changelog post

Steven Tey2fb7c34bbae4
diff --git a/app/(marketing)/components/mdx.tsx b/app/(marketing)/components/mdx.tsx
index 829df4c65e..e8f401c9c5 100644
--- a/app/(marketing)/components/mdx.tsx
+++ b/app/(marketing)/components/mdx.tsx
@@ -69,7 +69,15 @@ export function MDX({ code, images, tweets, repos }: MDXProps) {
};
return (
- <article className="prose prose-gray mx-5 w-full transition-all prose-headings:font-display prose-h2:text-3xl prose-a:font-medium prose-a:text-gray-500 prose-a:underline-offset-4 hover:prose-a:text-black prose-thead:text-lg md:mx-0 md:prose-lg">
+ <article
+ className={`
+ prose prose-gray mx-5 w-full transition-all md:prose-lg prose-headings:font-display
+ prose-h2:text-3xl prose-a:font-medium
+ prose-a:text-gray-500 prose-a:underline-offset-4 hover:prose-a:text-black prose-code:rounded-md
+ prose-code:bg-gray-200 prose-code:px-2 prose-code:py-1 prose-code:font-medium prose-code:text-rose-500 prose-code:before:hidden prose-code:after:hidden
+ prose-thead:text-lg md:mx-0
+ `}
+ >
<Component components={{ ...components, MDXImage, MDXTweet, MDXRepo }} />
</article>
);
diff --git a/components/app/links/link-filters.tsx b/components/app/links/link-filters.tsx
index af64997a22..13b2726b15 100644
--- a/components/app/links/link-filters.tsx
+++ b/components/app/links/link-filters.tsx
@@ -1,5 +1,5 @@
import { useRouter } from "next/router";
-import { useRef, useState } from "react";
+import { useCallback, useEffect, useRef, useState } from "react";
import { nFormatter, setQueryString } from "@/lib/utils";
import { ChevronRight, XCircle, Search } from "lucide-react";
import useDomains from "@/lib/swr/use-domains";
@@ -23,7 +23,7 @@ export default function LinkFilters() {
<div className="grid w-full gap-6 rounded-md bg-white p-5 lg:divide-y lg:divide-gray-300">
<div className="grid gap-3">
<div className="flex items-center justify-between">
- <h3 className="mt-2 ml-1 font-semibold">Filter Links</h3>
+ <h3 className="ml-1 mt-2 font-semibold">Filter Links</h3>
{(search || domain || status) && (
<ClearButton searchInputRef={searchInputRef} />
)}
@@ -60,6 +60,26 @@ const SearchBox = ({ searchInputRef }: { searchInputRef }) => {
}, 500);
const { isValidating } = useLinks();
+ const onKeyDown = useCallback((e: KeyboardEvent) => {
+ const target = e.target as HTMLElement;
+ // only focus on filter input when:
+ // - user is not typing in an input or textarea
+ // - there is no existing modal backdrop (i.e. no other modal is open)
+ if (
+ e.key === "/" &&
+ target.tagName !== "INPUT" &&
+ target.tagName !== "TEXTAREA"
+ ) {
+ e.preventDefault();
+ searchInputRef.current?.focus();
+ }
+ }, []);
+
+ useEffect(() => {
+ document.addEventListener("keydown", onKeyDown);
+ return () => document.removeEventListener("keydown", onKeyDown);
+ }, [onKeyDown]);
+
return (
<div className="relative">
<div className="pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3">
diff --git a/package.json b/package.json
index 200c2cdf24..485563f0ac 100644
--- a/package.json
+++ b/package.json
@@ -50,7 +50,7 @@
"html-escaper": "^3.0.3",
"i": "^0.3.7",
"js-cookie": "^3.0.5",
- "lucide-react": "^0.172.0",
+ "lucide-react": "^0.192.0",
"mailing-core": "^0.9.1",
"ms": "^2.1.3",
"next": "^13.3.2",
diff --git a/posts/changelog/duplicating-links.mdx b/posts/changelog/duplicating-links.mdx
index deeefa3b02..834455dcd6 100644
--- a/posts/changelog/duplicating-links.mdx
+++ b/posts/changelog/duplicating-links.mdx
@@ -1,7 +1,7 @@
---
title: Ability to duplicate a link
publishedAt: 2023-04-25
-summary: "You can now duplicate a link on Dub with a single click. "
+summary: "You can now duplicate a link on Dub with a single click."
image: "https://d2vwwcvoksz7ty.cloudfront.net/changelog/duplicate-links.png"
author: "steventey"
---
diff --git a/posts/changelog/keyboard-shortcuts.mdx b/posts/changelog/keyboard-shortcuts.mdx
new file mode 100644
index 0000000000..518afabe77
--- /dev/null
+++ b/posts/changelog/keyboard-shortcuts.mdx
@@ -0,0 +1,22 @@
+---
+title: Keyboard shortcuts
+publishedAt: 2023-05-01
+summary: "Introducing keyboard shortcuts on Dub"
+image: "https://d2vwwcvoksz7ty.cloudfront.net/changelog/keyboard-shortcuts.png"
+author: "steventey"
+---
+
+Introducing keyboard shortcuts on Dub.
+
+Here's a list of all the shortcuts to get you started:
+
+| Shortcut | Function | Link specific? |
+| -------- | --------------------------------- | -------------- |
+| `c` | Create a new short link | No |
+| `/` | Focus on the link search input | No |
+| `e` | Edit the selected short link | Yes |
+| `d` | Duplicate the selected short link | Yes |
+| `a` | Archive the selected short link | Yes |
+| `x` | Delete the selected short link | Yes |
+
+Shoutout to Flo for this [feature request](https://github.com/steven-tey/dub/issues/164)!
diff --git a/tsconfig.json b/tsconfig.json
index 5039d31128..8a09964213 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,16 +1,30 @@
{
"compilerOptions": {
"target": "es5",
- "lib": ["dom", "dom.iterable", "esnext"],
+ "lib": [
+ "dom",
+ "dom.iterable",
+ "esnext"
+ ],
"allowJs": true,
"skipLibCheck": true,
"baseUrl": ".",
"paths": {
- "@/components/*": ["components/*"],
- "@/pages/*": ["pages/*"],
- "@/lib/*": ["lib/*"],
- "@/styles/*": ["styles/*"],
- "contentlayer/generated": ["./.contentlayer/generated"]
+ "@/components/*": [
+ "components/*"
+ ],
+ "@/pages/*": [
+ "pages/*"
+ ],
+ "@/lib/*": [
+ "lib/*"
+ ],
+ "@/styles/*": [
+ "styles/*"
+ ],
+ "contentlayer/generated": [
+ "./.contentlayer/generated"
+ ]
},
"downlevelIteration": true,
"forceConsistentCasingInFileNames": true,
@@ -30,6 +44,13 @@
// }
// ],
// "strictNullChecks": true
+ ,
+ "plugins": [
+ {
+ "name": "next"
+ }
+ ],
+ "strictNullChecks": true
},
"include": [
"next-env.d.ts",
@@ -37,6 +58,10 @@
"**/*.tsx"
// TODO: Ditto from above
//".next/types/**/*.ts"
+ ,
+ ".next/types/**/*.ts"
],
- "exclude": ["node_modules"]
+ "exclude": [
+ "node_modules"
+ ]
}
diff --git a/yarn.lock b/yarn.lock
index ff38e011ab..e7abe3c205 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -5394,10 +5394,10 @@ lru-cache@^7.4.4, lru-cache@^7.5.1, lru-cache@^7.7.1:
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-7.14.1.tgz#8da8d2f5f59827edb388e63e459ac23d6d408fea"
integrity sha512-ysxwsnTKdAx96aTRdhDOCQfDgbHnt8SK0KY8SEjO0wHinhWOFTESbjVCMPbU1uGXg/ch4lifqx0wfjOawU2+WA==
-lucide-react@^0.172.0:
- version "0.172.0"
- resolved "https://registry.yarnpkg.com/lucide-react/-/lucide-react-0.172.0.tgz#25c98e3501cf8d6ea633ba8d6ab560526524a525"
- integrity sha512-Rpc0RSYGEFFrcT2toNjSzYKZ40rfc0D7vYp6C27e86Qyh5TwtPs5LS14hnjweH1REk45AFNeVnU+z+rXvb93ug==
+lucide-react@^0.192.0:
+ version "0.192.0"
+ resolved "https://registry.yarnpkg.com/lucide-react/-/lucide-react-0.192.0.tgz#82111328b2e9153e661c0873c8edb0e843b7dd10"
+ integrity sha512-ThZ1jGJhUzDP8oQbHtvvG/xh0uodewEt0G6aM/pAtC9RRKPZWNHKmDfoc5sbBC5hU9CHAYknq4/R/JY/QzLOjg==
mailing-core@^0.9.1:
version "0.9.1"