@upstash/react-redis-browser 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2790,13 +2790,21 @@ var units = {
2790
2790
  second: 1e3
2791
2791
  };
2792
2792
  function formatTime(seconds) {
2793
+ let milliseconds = seconds * 1e3;
2794
+ const parts = [];
2793
2795
  for (const [unit, value] of Object.entries(units)) {
2794
- const interval = seconds * 1e3 / value;
2795
- if (interval >= 1) {
2796
- return `${Math.floor(interval)} ${unit}${interval > 1 && unit !== "min" ? "s" : ""}`;
2796
+ if (milliseconds >= value) {
2797
+ const amount = Math.floor(milliseconds / value);
2798
+ const plural = amount > 1 ? "s" : "";
2799
+ const label = unit === "month" ? ` month${plural}` : unit === "year" ? ` year${plural}` : unit[0];
2800
+ parts.push(`${amount}${label}`);
2801
+ milliseconds %= value;
2797
2802
  }
2798
2803
  }
2799
- return "just now";
2804
+ if (parts.length === 0) {
2805
+ parts.push("0s");
2806
+ }
2807
+ return parts.slice(0, 2).join(" ");
2800
2808
  }
2801
2809
 
2802
2810
  // src/components/ui/toast.tsx
@@ -5506,7 +5514,22 @@ function Sidebar() {
5506
5514
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex h-10 items-center justify-between pl-1", children: [
5507
5515
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DisplayDbSize, {}),
5508
5516
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-1", children: [
5509
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, { className: "h-7 w-7 px-0", onClick: refetch, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Spinner, { isLoading: query.isFetching, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconRefresh, { size: 16 }) }) }),
5517
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5518
+ Button,
5519
+ {
5520
+ className: "h-7 w-7 px-0",
5521
+ onClick: () => {
5522
+ refetch();
5523
+ queryClient.invalidateQueries({
5524
+ queryKey: [FETCH_LIST_ITEMS_QUERY_KEY]
5525
+ });
5526
+ queryClient.invalidateQueries({
5527
+ queryKey: [FETCH_DB_SIZE_QUERY_KEY]
5528
+ });
5529
+ },
5530
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Spinner, { isLoading: query.isFetching, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconRefresh, { size: 16 }) })
5531
+ }
5532
+ ),
5510
5533
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AddKeyModal, {})
5511
5534
  ] })
5512
5535
  ] }),
package/dist/index.mjs CHANGED
@@ -2790,13 +2790,21 @@ var units = {
2790
2790
  second: 1e3
2791
2791
  };
2792
2792
  function formatTime(seconds) {
2793
+ let milliseconds = seconds * 1e3;
2794
+ const parts = [];
2793
2795
  for (const [unit, value] of Object.entries(units)) {
2794
- const interval = seconds * 1e3 / value;
2795
- if (interval >= 1) {
2796
- return `${Math.floor(interval)} ${unit}${interval > 1 && unit !== "min" ? "s" : ""}`;
2796
+ if (milliseconds >= value) {
2797
+ const amount = Math.floor(milliseconds / value);
2798
+ const plural = amount > 1 ? "s" : "";
2799
+ const label = unit === "month" ? ` month${plural}` : unit === "year" ? ` year${plural}` : unit[0];
2800
+ parts.push(`${amount}${label}`);
2801
+ milliseconds %= value;
2797
2802
  }
2798
2803
  }
2799
- return "just now";
2804
+ if (parts.length === 0) {
2805
+ parts.push("0s");
2806
+ }
2807
+ return parts.slice(0, 2).join(" ");
2800
2808
  }
2801
2809
 
2802
2810
  // src/components/ui/toast.tsx
@@ -5506,7 +5514,22 @@ function Sidebar() {
5506
5514
  /* @__PURE__ */ jsxs30("div", { className: "flex h-10 items-center justify-between pl-1", children: [
5507
5515
  /* @__PURE__ */ jsx41(DisplayDbSize, {}),
5508
5516
  /* @__PURE__ */ jsxs30("div", { className: "flex gap-1", children: [
5509
- /* @__PURE__ */ jsx41(Button, { className: "h-7 w-7 px-0", onClick: refetch, children: /* @__PURE__ */ jsx41(Spinner, { isLoading: query.isFetching, children: /* @__PURE__ */ jsx41(IconRefresh, { size: 16 }) }) }),
5517
+ /* @__PURE__ */ jsx41(
5518
+ Button,
5519
+ {
5520
+ className: "h-7 w-7 px-0",
5521
+ onClick: () => {
5522
+ refetch();
5523
+ queryClient.invalidateQueries({
5524
+ queryKey: [FETCH_LIST_ITEMS_QUERY_KEY]
5525
+ });
5526
+ queryClient.invalidateQueries({
5527
+ queryKey: [FETCH_DB_SIZE_QUERY_KEY]
5528
+ });
5529
+ },
5530
+ children: /* @__PURE__ */ jsx41(Spinner, { isLoading: query.isFetching, children: /* @__PURE__ */ jsx41(IconRefresh, { size: 16 }) })
5531
+ }
5532
+ ),
5510
5533
  /* @__PURE__ */ jsx41(AddKeyModal, {})
5511
5534
  ] })
5512
5535
  ] }),
package/package.json CHANGED
@@ -1 +1 @@
1
- { "name": "@upstash/react-redis-browser", "version": "v0.1.2", "main": "./dist/index.js", "types": "./dist/index.d.ts", "license": "MIT", "private": false, "publishConfig": { "access": "public" }, "bugs": { "url": "https://github.com/upstash/react-redis-browser/issues" }, "homepage": "https://github.com/upstash/react-redis-browser", "files": [ "./dist/**" ], "scripts": { "build": "tsup", "dev": "vite", "lint": "tsc && eslint", "fmt": "prettier --write ./src" }, "lint-staged": { "**/*.{js,ts,tsx}": [ "prettier --write", "eslint --fix" ] }, "dependencies": { "@ianvs/prettier-plugin-sort-imports": "^4.4.0", "@monaco-editor/react": "^4.6.0", "@radix-ui/react-alert-dialog": "^1.0.5", "@radix-ui/react-context-menu": "^2.2.2", "@radix-ui/react-dialog": "^1.0.5", "@radix-ui/react-dropdown-menu": "^2.1.2", "@radix-ui/react-icons": "1.3.0", "@radix-ui/react-popover": "^1.0.7", "@radix-ui/react-portal": "^1.1.2", "@radix-ui/react-scroll-area": "^1.0.3", "@radix-ui/react-select": "^2.0.0", "@radix-ui/react-slot": "^1.0.2", "@radix-ui/react-toast": "^1.1.5", "@radix-ui/react-tooltip": "^1.0.7", "@tabler/icons-react": "^3.19.0", "@tanstack/react-query": "^5.32.0", "@types/bytes": "^3.1.4", "@upstash/redis": "^1.34.3", "bytes": "^3.1.2", "react-hook-form": "^7.53.0", "react-resizable-panels": "^2.1.4", "zustand": "5.0.0" }, "devDependencies": { "postcss-prefix-selector": "^2.1.0", "@types/node": "^22.8.4", "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1", "@typescript-eslint/eslint-plugin": "8.4.0", "@typescript-eslint/parser": "8.4.0", "@vitejs/plugin-react": "^4.1.0", "autoprefixer": "^10.4.14", "class-variance-authority": "^0.7.0", "clsx": "^2.0.0", "eslint": "9.10.0", "eslint-plugin-unicorn": "55.0.0", "postcss": "^8.4.31", "prettier": "^3.0.3", "prettier-plugin-tailwindcss": "^0.5.5", "react": "^18.3.1", "react-dom": "^18.3.1", "tailwind-merge": "^2.5.4", "tailwindcss": "^3.4.14", "tailwindcss-animate": "^1.0.7", "tsup": "^8.3.5", "typescript": "^5.0.4", "vite": "^5.4.10", "vite-tsconfig-paths": "^5.0.1" }, "peerDependencies": { "react": "^18.2.0 || ^19", "react-dom": "^18.2.0 || ^19" } }
1
+ { "name": "@upstash/react-redis-browser", "version": "v0.1.3", "main": "./dist/index.js", "types": "./dist/index.d.ts", "license": "MIT", "private": false, "publishConfig": { "access": "public" }, "bugs": { "url": "https://github.com/upstash/react-redis-browser/issues" }, "homepage": "https://github.com/upstash/react-redis-browser", "files": [ "./dist/**" ], "scripts": { "build": "tsup", "dev": "vite", "lint": "tsc && eslint", "fmt": "prettier --write ./src" }, "lint-staged": { "**/*.{js,ts,tsx}": [ "prettier --write", "eslint --fix" ] }, "dependencies": { "@ianvs/prettier-plugin-sort-imports": "^4.4.0", "@monaco-editor/react": "^4.6.0", "@radix-ui/react-alert-dialog": "^1.0.5", "@radix-ui/react-context-menu": "^2.2.2", "@radix-ui/react-dialog": "^1.0.5", "@radix-ui/react-dropdown-menu": "^2.1.2", "@radix-ui/react-icons": "1.3.0", "@radix-ui/react-popover": "^1.0.7", "@radix-ui/react-portal": "^1.1.2", "@radix-ui/react-scroll-area": "^1.0.3", "@radix-ui/react-select": "^2.0.0", "@radix-ui/react-slot": "^1.0.2", "@radix-ui/react-toast": "^1.1.5", "@radix-ui/react-tooltip": "^1.0.7", "@tabler/icons-react": "^3.19.0", "@tanstack/react-query": "^5.32.0", "@types/bytes": "^3.1.4", "@upstash/redis": "^1.34.3", "bytes": "^3.1.2", "react-hook-form": "^7.53.0", "react-resizable-panels": "^2.1.4", "zustand": "5.0.0" }, "devDependencies": { "postcss-prefix-selector": "^2.1.0", "@types/node": "^22.8.4", "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1", "@typescript-eslint/eslint-plugin": "8.4.0", "@typescript-eslint/parser": "8.4.0", "@vitejs/plugin-react": "^4.1.0", "autoprefixer": "^10.4.14", "class-variance-authority": "^0.7.0", "clsx": "^2.0.0", "eslint": "9.10.0", "eslint-plugin-unicorn": "55.0.0", "postcss": "^8.4.31", "prettier": "^3.0.3", "prettier-plugin-tailwindcss": "^0.5.5", "react": "^18.3.1", "react-dom": "^18.3.1", "tailwind-merge": "^2.5.4", "tailwindcss": "^3.4.14", "tailwindcss-animate": "^1.0.7", "tsup": "^8.3.5", "typescript": "^5.0.4", "vite": "^5.4.10", "vite-tsconfig-paths": "^5.0.1" }, "peerDependencies": { "react": "^18.2.0 || ^19", "react-dom": "^18.2.0 || ^19" } }