diff --git a/core/assets/css/app.css b/core/assets/css/app.css index 8de75235..c1767cec 100644 --- a/core/assets/css/app.css +++ b/core/assets/css/app.css @@ -84,3 +84,15 @@ span.line.highlighted { width: 100%; display: inline-block; } + +span.line { + text-wrap: pretty; +} + +span.line.diff.add { + background-color: rgba(16, 185, 129, 0.14); +} + +span.line.diff.remove { + background-color: rgba(244, 63, 94, 0.14); +} diff --git a/core/assets/js/app.js b/core/assets/js/app.js index 61cffec3..3669907b 100644 --- a/core/assets/js/app.js +++ b/core/assets/js/app.js @@ -33,7 +33,10 @@ import Chart from "chart.js/auto"; import { parse } from "best-effort-json-parser"; import { codeToHtml } from "shiki"; -import { transformerNotationHighlight } from "@shikijs/transformers"; +import { + transformerNotationHighlight, + transformerNotationDiff, +} from "@shikijs/transformers"; import * as Sentry from "@sentry/browser"; import Tracker from "@openreplay/tracker"; @@ -60,6 +63,9 @@ import "@getcanary/web/components/canary-search-match-github-discussion.js"; import "@getcanary/web/components/canary-ask.js"; import "@getcanary/web/components/canary-ask-results.js"; import "@getcanary/web/components/canary-tooltip.js"; +import "@getcanary/web/components/canary-footer.js"; +import "@getcanary/web/components/canary-filter-tabs-glob.js"; +import "@getcanary/web/components/canary-filter-tags.js"; const csrfToken = document .querySelector("meta[name='csrf-token']") @@ -80,7 +86,10 @@ const hooks = { codeToHtml(this.el.textContent, { lang: "html", theme: "rose-pine-dawn", - transformers: [transformerNotationHighlight()], + transformers: [ + transformerNotationHighlight(), + transformerNotationDiff(), + ], }).then((html) => { this.el.innerHTML = html; }); diff --git a/core/assets/package-lock.json b/core/assets/package-lock.json index acbe175e..b536d453 100644 --- a/core/assets/package-lock.json +++ b/core/assets/package-lock.json @@ -5,7 +5,7 @@ "packages": { "": { "dependencies": { - "@getcanary/web": "^1.0.10", + "@getcanary/web": "^1.0.11", "@openreplay/tracker": "^14.0.9", "@sentry/browser": "^8.33.1", "best-effort-json-parser": "^1.1.2", @@ -446,9 +446,9 @@ "integrity": "sha512-kym7SodPp8/wloecOpcmSnWJsK7M0E5Wg8UcFA+uO4B9s5d0ywXOEro/8HM9x0rW+TljRzul/14UYz3TleT3ig==" }, "node_modules/@getcanary/web": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/@getcanary/web/-/web-1.0.10.tgz", - "integrity": "sha512-gkOyjU0K/xS+rxDxHDS7lOOFKK79g+fwuB2iB2HFcZX2/YEImLBNz5xmDmJTXYEaEGcOdn4Th9W46U0fKI95QQ==", + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@getcanary/web/-/web-1.0.11.tgz", + "integrity": "sha512-4+1Kz7aCF02QSNvMb2BnnvzeA5YZ1zJU3Aa2Tzqt09Zinb1w1dsO41CWDLuvOd3/S6TBf0n2soYlppuVDcvkpw==", "dependencies": { "@floating-ui/dom": "^1.6.8", "@lit-labs/observers": "^2.0.2", @@ -458,8 +458,7 @@ "best-effort-json-parser": "^1.1.2", "lit": "^3.1.4", "marked": "^14.0.0", - "picomatch": "^4.0.2", - "prismjs": "^1.29.0" + "picomatch": "^4.0.2" } }, "node_modules/@getcanary/web/node_modules/picomatch": { @@ -1833,14 +1832,6 @@ "svelte": "^3.2.0 || ^4.0.0-next.0 || ^5.0.0-next.0" } }, - "node_modules/prismjs": { - "version": "1.29.0", - "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.29.0.tgz", - "integrity": "sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q==", - "engines": { - "node": ">=6" - } - }, "node_modules/property-information": { "version": "6.5.0", "resolved": "https://registry.npmjs.org/property-information/-/property-information-6.5.0.tgz", diff --git a/core/assets/package.json b/core/assets/package.json index 984aad6d..35018180 100644 --- a/core/assets/package.json +++ b/core/assets/package.json @@ -20,7 +20,7 @@ "typescript": "^5.4.5" }, "dependencies": { - "@getcanary/web": "^1.0.10", + "@getcanary/web": "^1.0.11", "@openreplay/tracker": "^14.0.9", "@sentry/browser": "^8.33.1", "best-effort-json-parser": "^1.1.2", diff --git a/core/lib/canary/accounts/project.ex b/core/lib/canary/accounts/project.ex index 2048aca3..330009ec 100644 --- a/core/lib/canary/accounts/project.ex +++ b/core/lib/canary/accounts/project.ex @@ -31,7 +31,24 @@ defmodule Canary.Accounts.Project do create :create do primary? true - accept [:account_id, :name] + + accept [:name] + argument :account_id, :uuid, allow_nil?: false + + change manage_relationship(:account_id, :account, type: :append) + + change fn changeset, _ -> + account_id = Ash.Changeset.get_argument(changeset, :account_id) + + with {:ok, %{billing: %{membership: %{tier: tier}}}} <- + Canary.Accounts.Account + |> Ash.get(account_id, load: [billing: [:membership]]) do + changeset + |> Ash.Changeset.force_change_attribute(:public, tier == :admin) + else + _ -> changeset + end + end change fn changeset, _ -> key = "cp_" <> String.slice(Ecto.UUID.generate(), 0..7) diff --git a/core/lib/canary_web/components/layouts/app.html.heex b/core/lib/canary_web/components/layouts/app.html.heex index 13aeda53..fdbe39c6 100644 --- a/core/lib/canary_web/components/layouts/app.html.heex +++ b/core/lib/canary_web/components/layouts/app.html.heex @@ -1,9 +1,9 @@
-