Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-gordon committed Mar 17, 2024
0 parents commit 9f2e746
Show file tree
Hide file tree
Showing 58 changed files with 3,285 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
}
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
- ~~supports markdown~~
- ~~we're going to use prosemirror~~
- ~~keep it stored in a readable, markdown-ish format. files over app~~
- be able to toggle anything
- a place where toggle things appear or something
- use markdown annotations to link to "canvases of content"
- there is a canvas around the document
- user can create notes
- the user can highlight sections and add notes
- then they can move through sections in a review mode where suggestions are made for each change
- the user can bind references or notes to a particular place in the text, kind of like stickies that live inside the text. those stickies can inform the AI as well.
- another concept is global state for a document, and custom renderers, also site scraping
- you can highlight and run AI functions
Binary file added bun.lockb
Binary file not shown.
13 changes: 13 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
72 changes: 72 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"name": "app",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
"dependencies": {
"@radix-ui/react-accordion": "latest",
"@radix-ui/react-alert-dialog": "latest",
"@radix-ui/react-avatar": "latest",
"@radix-ui/react-checkbox": "latest",
"@radix-ui/react-collapsible": "latest",
"@radix-ui/react-context-menu": "latest",
"@radix-ui/react-dialog": "latest",
"@radix-ui/react-dropdown-menu": "latest",
"@radix-ui/react-hover-card": "latest",
"@radix-ui/react-label": "latest",
"@radix-ui/react-menubar": "latest",
"@radix-ui/react-navigation-menu": "latest",
"@radix-ui/react-popover": "latest",
"@radix-ui/react-progress": "latest",
"@radix-ui/react-radio-group": "latest",
"@radix-ui/react-select": "latest",
"@radix-ui/react-separator": "latest",
"@radix-ui/react-slider": "latest",
"@radix-ui/react-slot": "latest",
"@radix-ui/react-switch": "latest",
"@radix-ui/react-tabs": "latest",
"@radix-ui/react-toggle": "latest",
"@radix-ui/react-toggle-group": "latest",
"@radix-ui/react-tooltip": "latest",
"@tiptap/extension-link": "^2.2.4",
"@tiptap/pm": "^2.2.4",
"@tiptap/react": "^2.2.4",
"@tiptap/starter-kit": "^2.2.4",
"class-variance-authority": "latest",
"clsx": "latest",
"cmdk": "latest",
"novel": "^0.2.12",
"react": "^18.2.0",
"react-day-picker": "latest",
"react-dom": "^18.2.0",
"react-hook-form": "latest",
"react-icons": "latest",
"sonner": "latest",
"tailwind-merge": "latest",
"tiptap-markdown": "^0.8.9",
"zustand": "latest"
},
"devDependencies": {
"@tailwindcss/typography": "^0.5.10",
"@types/react": "^18.2.56",
"@types/react-dom": "^18.2.19",
"@typescript-eslint/eslint-plugin": "^7.0.2",
"@typescript-eslint/parser": "^7.0.2",
"@vitejs/plugin-react": "^4.2.1",
"autoprefixer": "latest",
"eslint": "^8.56.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.5",
"postcss": "latest",
"tailwindcss": "latest",
"tailwindcss-animate": "latest",
"typescript": "^5.2.2",
"vite": "^5.1.4"
}
}
6 changes: 6 additions & 0 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
1 change: 1 addition & 0 deletions public/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { TooltipProvider } from "./ui/tooltip";
import { Toaster } from "./ui/toaster";
import { TipTap } from "./components/TipTap";

export default function App() {
return (
<TooltipProvider>
<div className="h-[100dvh] grid justify-center p-5">
<TipTap />
</div>
<Toaster />
</TooltipProvider>
);
}
1 change: 1 addition & 0 deletions src/assets/react.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions src/components/TipTap.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import type { EditorProps } from "@tiptap/pm/view";
import { EditorContent, useEditor } from "@tiptap/react";
import StarterKit from "@tiptap/starter-kit";
import { Markdown } from "tiptap-markdown";
import { Link } from "@tiptap/extension-link";
import { usePersistedStore } from "../lib/usePersistedStore";

// define your extension array
const extensions = [
StarterKit,
Markdown.configure({
linkify: true,
}),
Link.configure({
autolink: true,
}),
];

const editorProps: EditorProps = {
attributes: {
class:
"main-editor prose prose-neutral lg:prose-lg xl:prose-xl dark:prose-invert prose-sm sm:prose-base m-5 focus:outline-none",
spellcheck: "false",
},
};

export function TipTap() {
const content = usePersistedStore((state) => state.content);
const editor = useEditor({
extensions,
content,
editorProps,
onUpdate: ({ editor }) => {
usePersistedStore.setState({
content: editor.storage.markdown.getMarkdown(),
});
},
});

return <EditorContent editor={editor} />;
}
31 changes: 31 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
@import url("https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;700&&family=Pathway+Extreme:wght@700&display=swap");

:root {
--font-sans: PP Neue Montreal TT, Open Sans;
--font-display: Pathway Extreme;
}

@tailwind base;
@tailwind components;
@tailwind utilities;

html {
@apply antialiased;
}

body {
@apply bg-white text-foreground;
}

@layer components {
*,
::before,
::after {
--tw-ring-color: theme("colors.foreground/0.25");
@apply border-neutral-200;
}
}

.main-editor {
@apply bg-white p-4;
}
18 changes: 18 additions & 0 deletions src/lib/usePersistedStore.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { JSONContent } from "@tiptap/react";
import { create } from "zustand";
import { persist } from "zustand/middleware";

type PersistedState = {
content: JSONContent;
};

export const usePersistedStore = create<PersistedState>()(
persist(
(_set) => ({
content: {},
}),
{
name: "persisted-editor-content",
}
)
);
10 changes: 10 additions & 0 deletions src/main.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App.tsx";
import "./index.css";

ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode>
<App />
</React.StrictMode>
);
59 changes: 59 additions & 0 deletions src/ui/accordion.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
"use client";

import * as AccordionPrimitive from "@radix-ui/react-accordion";
import * as React from "react";

import { LuChevronDown } from "react-icons/lu";
import { cn } from "./cn";

const Accordion = AccordionPrimitive.Root;

const AccordionItem = React.forwardRef<
React.ElementRef<typeof AccordionPrimitive.Item>,
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>
>(({ className, ...props }, ref) => (
<AccordionPrimitive.Item
ref={ref}
className={cn("border-b", className)}
{...props}
/>
));
AccordionItem.displayName = AccordionPrimitive.Item.displayName;

const AccordionTrigger = React.forwardRef<
React.ElementRef<typeof AccordionPrimitive.Trigger>,
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>
>(({ className, children, ...props }, ref) => (
<AccordionPrimitive.Header className="flex">
<AccordionPrimitive.Trigger
ref={ref}
className={cn(
"flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",
className,
)}
{...props}
>
{children}
<LuChevronDown
className="h-4 w-4 shrink-0 transition-transform duration-200"
/>
</AccordionPrimitive.Trigger>
</AccordionPrimitive.Header>
));
AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;

const AccordionContent = React.forwardRef<
React.ElementRef<typeof AccordionPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>
>(({ className, children, ...props }, ref) => (
<AccordionPrimitive.Content
ref={ref}
className="overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"
{...props}
>
<div className={cn("pb-4 pt-0", className)}>{children}</div>
</AccordionPrimitive.Content>
));
AccordionContent.displayName = AccordionPrimitive.Content.displayName;

export { Accordion, AccordionContent,AccordionItem, AccordionTrigger };
Loading

0 comments on commit 9f2e746

Please sign in to comment.