A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
feedback box (#514)
Myles Scolnick3fe25729623f
diff --git a/frontend/src/components/editor/chrome/footer/feedback-button.tsx b/frontend/src/components/editor/chrome/footer/feedback-button.tsxnew file mode 100644index 0000000000..d4769cf3ab--- /dev/null+++ b/frontend/src/components/editor/chrome/footer/feedback-button.tsx@@ -0,0 +1,127 @@+/* Copyright 2023 Marimo. All rights reserved. */+import { useImperativeModal } from "@/components/modal/ImperativeModal";+import {+ DialogFooter,+ DialogContent,+ DialogHeader,+ DialogTitle,+ DialogDescription,+} from "@/components/ui/dialog";+import { Slot } from "@radix-ui/react-slot";+import React, { PropsWithChildren } from "react";+import { Button } from "@/components/ui/button";+import { Textarea } from "@/components/ui/textarea";+import { toast } from "@/components/ui/use-toast";++export const FeedbackButton: React.FC<PropsWithChildren> = ({ children }) => {+ const { openModal, closeModal } = useImperativeModal();++ return (+ <Slot onClick={() => openModal(<FeedbackModal onClose={closeModal} />)}>+ {children}+ </Slot>+ );+};++const EmojiToRating: Record<string, number> = {+ "😡": 1,+ "🙁": 2,+ "😐": 3,+ "🙂": 4,+ "😍": 5,+};++const FeedbackModal: React.FC<{+ onClose: () => void;+}> = ({ onClose }) => {+ return (+ <DialogContent className="w-fit">+ <form+ onSubmit={async (e) => {+ e.preventDefault();++ const formData = new FormData(e.target as HTMLFormElement);+ const rating = formData.get("rating");+ const message = formData.get("message");++ // Fire-and-forget we don't care about the response+ void fetch("https://marimo.io/api/feedback", {+ method: "POST",+ headers: {+ "Content-Type": "application/json",+ },+ body: JSON.stringify({+ rating: rating,+ message,+ }),+ });+ onClose();+ toast({+ title: "Feedback sent!",+ description: "Thank you for your feedback!",+ });+ }}+ >+ <DialogHeader>+ <DialogTitle>Send Feedback</DialogTitle>+ <DialogDescription>+ Let us know what you think about marimo! If you have a bug that you+ would like to report, please use the{" "}+ <a+ href="https://github.com/marimo-team/marimo/issues"+ target="_blank"+ rel="noreferrer"+ className="underline"+ >+ GitHub issue tracker+ </a>+ .+ </DialogDescription>+ <DialogDescription>+ Your feedback is anonymous and will help us improve marimo. Thank+ you!+ </DialogDescription>+ </DialogHeader>+ <div className="flex flex-col gap-6 py-4">+ <div className="flex gap-5 justify-center">+ {Object.entries(EmojiToRating).map(([emoji, rating]) => (+ <label+ key={emoji}+ className="flex flex-col items-center select-none"+ >+ <input+ key={emoji}+ type="radio"+ className="peer hidden"+ name="rating"+ value={rating}+ aria-label={emoji}+ />+ <span className="text-4xl peer-checked:opacity-100 opacity-40 cursor-pointer">+ {emoji}+ </span>+ </label>+ ))}+ </div>+ <Textarea+ id="message"+ name="message"+ autoFocus={true}+ placeholder="Your feedback"+ rows={5}+ required={true}+ autoComplete="off"+ />+ </div>+ <DialogFooter>+ <Button variant="secondary" onClick={onClose}>+ Cancel+ </Button>+ <Button aria-label="Save" variant="default" type="submit">+ Send+ </Button>+ </DialogFooter>+ </form>+ </DialogContent>+ );+};diff --git a/frontend/src/components/editor/chrome/wrapper/footer.tsx b/frontend/src/components/editor/chrome/wrapper/footer.tsxindex 1e25649fc4..f67b11bfcb 100644--- a/frontend/src/components/editor/chrome/wrapper/footer.tsx+++ b/frontend/src/components/editor/chrome/wrapper/footer.tsx@@ -8,12 +8,14 @@ import {ScrollTextIcon,NetworkIcon,FileTextIcon,+ MessageCircleQuestionIcon,} from "lucide-react";import { cn } from "@/utils/cn";import { useChromeActions, useChromeState } from "../state";import { Tooltip } from "@/components/ui/tooltip";import { useAtomValue } from "jotai";import { cellErrorCount } from "@/core/cells/cells";+import { FeedbackButton } from "../footer/feedback-button";export const Footer: React.FC = () => {const { selectedPanel, panelLocation } = useChromeState();@@ -77,6 +79,12 @@ export const Footer: React.FC = () => {><PanelBottomIcon className="h-4 w-4" /></FooterItem>++ <FeedbackButton>+ <FooterItem tooltip="Send feedback!" selected={false}>+ <MessageCircleQuestionIcon className="h-4 w-4" />+ </FooterItem>+ </FeedbackButton></footer>);};