Skip to content

Commit

Permalink
Clean up logging and Prettier fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
AllegroFox committed Oct 21, 2024
1 parent 549d810 commit eb33a3c
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 33 deletions.
65 changes: 35 additions & 30 deletions app/columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ function OffsiteLink(href: string, linkText: any) {
);
}


// This type is used to define the shape of our data.
// NOTE: ctrPercent is undefined by default until set using getCTRPercent. It is
// made optional to help determine what's displayed in the Metrics column.
Expand Down Expand Up @@ -131,9 +130,7 @@ export type RecipeOrBranchInfo = RecipeInfo | BranchInfo;
* Opens the Limelight utility using window.postMessage, waits for a response,
* and sends message JSON as a payload for editing.
*/
function postMessageToLimelight(
editableJson: string
) {
function postMessageToLimelight(editableJson: string) {
let win = window.open("https://mozilla.github.io/limelight/?postMessage");

window.addEventListener(
Expand All @@ -143,13 +140,16 @@ function postMessageToLimelight(
if (event.origin !== "https://mozilla.github.io/limelight/") {
return;
}
(win as WindowProxy | null)?.postMessage({
type: "import",
value: editableJson,
}, "https://mozilla.github.io/limelight/")
(win as WindowProxy | null)?.postMessage(
{
type: "import",
value: editableJson,
},
"https://mozilla.github.io/limelight/",
);
},
false,
);
);
}

/**
Expand Down Expand Up @@ -244,31 +244,36 @@ export const fxmsMessageColumns: ColumnDef<FxMSMessageInfo>[] = [
accessorKey: "segment",
header: "",
cell: (props: any) => {
const supportedTypes = [
"infobar",
"spotlight",
];
const supportedTypes = ["infobar", "spotlight"];
if (supportedTypes.includes(props.row.original.template)) {
return <button onClick={() => postMessageToLimelight(props.row.original.editableJson)} className="underline text-primary visited:text-primary cursor-pointer hover:no-underline text-xs/[180%]">
Edit a copy of this message
<svg
fill="none"
viewBox="0 0 8 8"
className="inline h-[1.1rem] w-[1.1rem] px-1"
aria-hidden="true"
>
<path
clipRule="evenodd"
d="m1.71278 0h.57093c.31531 0 .57092.255837.57092.571429 0 .315591-.25561.571431-.57092.571431h-.57093c-.31531 0-.57093.25583-.57093.57143v4.57142c0 .3156.25562.57143.57093.57143h4.56741c.31531 0 .57093-.25583.57093-.57143v-.57142c0-.3156.25561-.57143.57092-.57143.31532 0 .57093.25583.57093.57143v.57142c0 .94678-.76684 1.71429-1.71278 1.71429h-4.56741c-.945943 0-1.71278-.76751-1.71278-1.71429v-4.57142c0-.946778.766837-1.71429 1.71278-1.71429zm5.71629 0c.23083.0002686.43879.13963.52697.353143.02881.069172.04375.143342.04396.218286v2.857141c0 .31559-.25561.57143-.57093.57143-.31531 0-.57092-.25584-.57092-.57143v-1.47771l-1.88006 1.88171c-.14335.14855-.35562.20812-.55523.15583-.19962-.0523-.35551-.20832-.40775-.40811-.05225-.19979.00727-.41225.15569-.55572l1.88006-1.88171h-1.47642c-.31531 0-.57093-.25584-.57093-.571431 0-.315592.25562-.571429.57093-.571429z"
fill="#5e5e72"
fillRule="evenodd"
></path>
</svg>
</button>
return (
<button
onClick={() =>
postMessageToLimelight(props.row.original.editableJson)
}
className="underline text-primary visited:text-primary cursor-pointer hover:no-underline text-xs/[180%]"
>
Edit a copy of this message
<svg
fill="none"
viewBox="0 0 8 8"
className="inline h-[1.1rem] w-[1.1rem] px-1"
aria-hidden="true"
>
<path
clipRule="evenodd"
d="m1.71278 0h.57093c.31531 0 .57092.255837.57092.571429 0 .315591-.25561.571431-.57092.571431h-.57093c-.31531 0-.57093.25583-.57093.57143v4.57142c0 .3156.25562.57143.57093.57143h4.56741c.31531 0 .57093-.25583.57093-.57143v-.57142c0-.3156.25561-.57143.57092-.57143.31532 0 .57093.25583.57093.57143v.57142c0 .94678-.76684 1.71429-1.71278 1.71429h-4.56741c-.945943 0-1.71278-.76751-1.71278-1.71429v-4.57142c0-.946778.766837-1.71429 1.71278-1.71429zm5.71629 0c.23083.0002686.43879.13963.52697.353143.02881.069172.04375.143342.04396.218286v2.857141c0 .31559-.25561.57143-.57093.57143-.31531 0-.57092-.25584-.57092-.57143v-1.47771l-1.88006 1.88171c-.14335.14855-.35562.20812-.55523.15583-.19962-.0523-.35551-.20832-.40775-.40811-.05225-.19979.00727-.41225.15569-.55572l1.88006-1.88171h-1.47642c-.31531 0-.57093-.25584-.57093-.571431 0-.315592.25562-.571429.57093-.571429z"
fill="#5e5e72"
fillRule="evenodd"
></path>
</svg>
</button>
);
}
return <></>;
},
}, {
},
{
accessorKey: "metrics",
header: () => (
<div className="flex flex-row items-center">
Expand Down
10 changes: 9 additions & 1 deletion components/ui/menubutton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@ import {
navigationMenuTriggerStyle,
navigationMenuItemStyle,
} from "@/components/ui/navigation-menu";
import { Menu, Hash, Book, AppWindow, Table, FileSearch, Lightbulb } from "lucide-react";
import {
Menu,
Hash,
Book,
AppWindow,
Table,
FileSearch,
Lightbulb,
} from "lucide-react";
import { cn } from "@/lib/utils";

const ListItem = React.forwardRef<
Expand Down
3 changes: 1 addition & 2 deletions lib/messageUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,8 @@ export function getEditableJSON(message: any): string {
if (!screen.id) {
screen.id = message.content.id;
}
})
});
}

return message;
}

Expand Down

0 comments on commit eb33a3c

Please sign in to comment.