Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MEGA PR -- summer work #1

Merged
merged 85 commits into from
Sep 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
9a3b419
Put SiteIds in src rather than env
ianconsolata Jun 10, 2021
b97a73e
trackGoal in the right place
ianconsolata Jun 10, 2021
30e0fec
Remove secret hidden messages button
ianconsolata Jun 11, 2021
39829e8
npm ci
ianconsolata Jun 15, 2021
6e1be5c
Add nvm, set node vrsion to 14
ianconsolata Jul 22, 2021
9e937f7
Add typescript
ianconsolata Jul 22, 2021
9d1ef58
Add helper functions to get Images and Links
ianconsolata Aug 2, 2021
710b522
Don't allow empty note titles
ianconsolata Aug 4, 2021
bb1b7d1
Allow any non-whitespace character to be used in tags
ianconsolata Aug 4, 2021
b250b0b
Change default image cropper settings
ianconsolata Aug 4, 2021
386c194
Add basic Modal for creating new concepts quickly
ianconsolata Jul 19, 2021
20b8536
Get basic structure for a modal create dialog in place
ianconsolata Jul 19, 2021
eb19a1e
WIP
ianconsolata Aug 3, 2021
a7c60dd
Install Plate
ianconsolata Aug 6, 2021
d805827
Add fontawesome icons
ianconsolata Aug 6, 2021
4eadf12
Add Tippy
ianconsolata Aug 6, 2021
c6c22ed
Install all styled-icons
ianconsolata Aug 6, 2021
9287626
New Plate based editor with all the bells and whistles
ianconsolata Aug 6, 2021
33da0b1
Add brand colors and brand fonts
ianconsolata Aug 6, 2021
3f1c113
Save full page editor with bells and whistles for later
ianconsolata Aug 6, 2021
792ffde
Working decentish modal creator
ianconsolata Aug 6, 2021
357f2fa
Simplify mopdal editor
ianconsolata Aug 6, 2021
30e89a3
Add basic styling for lists
ianconsolata Aug 7, 2021
6f68837
Fix the paragraph default font size
ianconsolata Aug 7, 2021
5eb6400
Merge CreateModal into ModalEditor, reset the editor correctly
ianconsolata Aug 7, 2021
cda47bb
Fix styling on lists
ianconsolata Aug 9, 2021
bfce621
Add back in H! autoformat
ianconsolata Aug 9, 2021
1777d71
Add comment about toggleList bug
ianconsolata Aug 9, 2021
ba02618
Remove default MediaEmbed plugin (only supports vimeo)
ianconsolata Aug 10, 2021
da0ae37
Add dark versions of brand colors for selected state
ianconsolata Aug 10, 2021
e97f753
Style Tweaks
ianconsolata Aug 12, 2021
0444f9d
Start work on new onboarding flow
ianconsolata Aug 12, 2021
14a3e55
Clean up styles after chat with Tani
ianconsolata Aug 12, 2021
945a665
Minor tweaks, remove dead code
ianconsolata Aug 13, 2021
5ebc27d
Working mentions, including adding new mentions
ianconsolata Aug 17, 2021
663d434
Tweak colors on buttons.
ianconsolata Aug 26, 2021
1e7a42c
Style tweaks to prepare for hexes
ianconsolata Aug 27, 2021
9ef52f5
proof of concept hex grid
travis Aug 13, 2021
dd99439
make hex backgrounds nicer
travis Aug 13, 2021
6d3311d
Tweak colors and spacing on grid
ianconsolata Aug 30, 2021
350d3c1
Move concept and note creation out into model/*
ianconsolata Aug 30, 2021
064a27b
Paired with Travis to center the hex titles
ianconsolata Aug 31, 2021
3846e65
fix for model concept
ianconsolata Aug 31, 2021
8fc7c4e
Use hex grid for main notes layout
ianconsolata Aug 31, 2021
8882961
fix refactor
ianconsolata Sep 1, 2021
5211e3e
Use ReactModal for ModalEditor
ianconsolata Sep 1, 2021
6cfd986
Add prettier
ianconsolata Sep 1, 2021
80929a8
New Editor can write notes in the new format
ianconsolata Sep 2, 2021
127f813
Remove old migrators
ianconsolata Sep 6, 2021
6d983fa
Remove old facebaby and itme.online code
ianconsolata Sep 6, 2021
9a11d33
Remove references to Follows, but keep code around
ianconsolata Sep 6, 2021
908d886
Remove backups
ianconsolata Sep 6, 2021
29cdc79
Remove link to solid pod url
ianconsolata Sep 6, 2021
da0f163
Only use one Plate Editor for now
ianconsolata Sep 6, 2021
8789a9f
Create new concepts from the modal
ianconsolata Sep 7, 2021
faa680b
Disable button if concept exists, add disabled css
ianconsolata Sep 7, 2021
29c41bb
Move EmptySlateJSON to utils/slate
ianconsolata Sep 8, 2021
6ca9fd0
Likely very buggy swap of the NotePage to use the new editor
ianconsolata Sep 8, 2021
b2e39f2
Remove super verbose debugging logs
ianconsolata Sep 8, 2021
fc1e395
Make sure to reset modal on cancel
ianconsolata Sep 9, 2021
cc3bca3
Write data in the new format from the note page
ianconsolata Sep 9, 2021
a4e02e8
Memoize JSON parsing
ianconsolata Sep 9, 2021
7000dbe
Fix destructive button
ianconsolata Sep 9, 2021
fe1e8df
Remove legacy editor components
ianconsolata Sep 13, 2021
e5c2e0a
Style tweaks to fix NotePage formatting
ianconsolata Sep 13, 2021
8107805
Add clickable links to concepts
ianconsolata Sep 14, 2021
61903b6
Reformat utils/uris
ianconsolata Sep 14, 2021
8844609
Remove ledgerTotal from facebaby
ianconsolata Sep 14, 2021
4162bbd
Add logging for failed node conversion
ianconsolata Sep 14, 2021
a90afd5
Add leaf conversion function
ianconsolata Sep 14, 2021
c231def
Include explicity dep on solid-client
ianconsolata Sep 16, 2021
742bf48
Initial notes on potential new index format
ianconsolata Sep 16, 2021
bf22ed9
Use cancel btn style on ImageUploader
ianconsolata Sep 16, 2021
a8b720b
Cleaned up the types on model/index a bit
ianconsolata Sep 16, 2021
bbf8818
Prototype of model changes to support Bookmarks
ianconsolata Sep 20, 2021
dc5bf4b
Set created date if none exists on Concept
ianconsolata Sep 20, 2021
78b7447
Display modified and created dates
ianconsolata Sep 20, 2021
88a0cc0
Add 404 if a note doesn't exist on the NotePage
ianconsolata Sep 20, 2021
cb31108
Oooops, don't reset the editor here.
ianconsolata Sep 21, 2021
774209e
slate-MentionSelect should always always be on top
ianconsolata Sep 21, 2021
dab36ed
Remove test mentionables
ianconsolata Sep 23, 2021
d13d159
Revert Hex dashboard, keep Hex components for #secret-project
ianconsolata Sep 24, 2021
9be5455
Prettier reformat #cosmetic
ianconsolata Sep 24, 2021
b563a7b
Remove the NewNoteForm (no longer exists)
ianconsolata Sep 24, 2021
fed27a5
tweak style
ianconsolata Sep 24, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
14
1 change: 1 addition & 0 deletions .prettierignore
1 change: 1 addition & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
205 changes: 205 additions & 0 deletions components/Create.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
import ReactModal from "react-modal";
import PlateEditor from "../components/Plate/Editor";
import { useState, useEffect } from "react";
import {
useStoreEditorValue,
useStoreEditorState,
usePlateActions,
} from "@udecode/plate";
import { EmptySlateJSON } from "../utils/slate";
import { useWebId, useThing } from "swrlit";
import { getUrl, isThingLocal } from "@inrupt/solid-client";

import { createOrUpdateSlateJSON, saveNote } from "../model/note";
import { createOrUpdateConceptIndex } from "../model/concept";
import { useWorkspace, useCurrentWorkspace } from "../hooks/app";
import { useConcept } from "../hooks/concepts";

const TabId = {
Concept: "Concept",
Bookmark: "Bookmark",
};

export function Tab({ title, selected, onClick }) {
const selectedClasses = "border-lagoon text-lagoon ";
const defaultClasses =
"border-transparent text-fog hover:text-storm hover:border-storm";
return (
<button
className={`whitespace-nowrap pb-4 px-1 border-b-2 font-medium text-sm ${
selected ? selectedClasses : defaultClasses
}`}
value={title}
onClick={(e) => {
e.preventDefault();
onClick(e);
}}
>
{title}
</button>
);
}

export function Tabs({ tabs, selectedTab, setSelectedTab }) {
return (
<div>
<div className="border-b border-mist">
<nav className="-mb-px flex space-x-8">
{tabs.map((t) => (
<Tab
title={t}
selected={selectedTab === t}
onClick={(e) => setSelectedTab(e.target.value)}
/>
))}
</nav>
</div>
</div>
);
}

export function CreateModal({ isOpen, closeModal }) {
const tabs = [TabId.Concept, TabId.Bookmark];
const [selectedTab, setSelectedTab] = useState(tabs[0]);
const [createAnother, setCreateAnother] = useState(false);
const [saving, setSaving] = useState(false);
const editorId = "create-modal";
const value = useStoreEditorValue(editorId);
const editor = useStoreEditorState(editorId);
const { setValue, resetEditor } = usePlateActions(editorId);

const webId = useWebId();
const { workspace, slug: workspaceSlug } = useCurrentWorkspace();
const [name, setName] = useState("");

const {
conceptUri,
concept,
index: conceptIndex,
saveIndex: saveConceptIndex,
} = useConcept(webId, workspaceSlug, name);

const conceptExists = concept && !isThingLocal(concept);

const save = async function save() {
const newNote = createOrUpdateSlateJSON(value);
const newConceptIndex = createOrUpdateConceptIndex(
editor,
workspace,
conceptIndex,
concept,
name
);
setSaving(true);
try {
await saveConceptIndex(newConceptIndex);
await saveNote(newNote, concept);
} catch (e) {
console.log("error saving note", e);
} finally {
setSaving(false);
}
};

const reset = () => {
resetEditor();
setValue(EmptySlateJSON);
setName("");
};

const close = () => {
reset();
closeModal();
};

const onSubmit = () => {
save();
if (createAnother) {
reset();
} else {
close();
}
};

return (
<ReactModal isOpen={isOpen}>
<form className="w-full max-w-sm">
<Tabs
tabs={tabs}
selectedTab={selectedTab}
setSelectedTab={setSelectedTab}
/>

{selectedTab === TabId.Concept ? (
<>
<div
className={`flex items-center border-b-2 py-2 ${
conceptExists
? "border-ember text-ember"
: "border-lagoon text-lagoon"
}`}
>
<input
className="appearance-none focus:ring-0 text-3xl bg-transparent outline-none border-none focus:border-none w-full mr-3 py-1 px-2 leading-tight focus:outline-none"
type="text"
placeholder="Untitled"
aria-label="Concept Name"
value={name}
onChange={(e) => setName(e.target.value)}
/>
{conceptExists ? (
<span className="whitespace-nowrap">
concept already exists
</span>
) : (
<></>
)}
</div>

<div className="text-left p-4">
<PlateEditor editorId={editorId} initialValue={value} />
</div>
</>
) : (
<span> upload image or link </span>
)}

<div className="flex justify-end border-t-2 border-echeveria py-2">
<label className="inline-flex items-center">
<input
className="form-checkbox text-echeveria"
type="checkbox"
checked={createAnother}
onChange={(e) => setCreateAnother(e.target.checked)}
/>
<span className="mx-2">Create another</span>
</label>
<button
type="button"
disabled={conceptExists || saving || !concept}
className={`btn ${saving ? "cursor-wait" : ""}`}
onClick={onSubmit}
>
Create
</button>
<button type="button" className="btn cancel" onClick={close}>
Cancel
</button>
</div>
</form>
</ReactModal>
);
}

export function CreateButton() {
const [modalOpen, setModalOpen] = useState(false);

return (
<div className="flex flex-row max-h-9 self-center">
<button className="flex btn" onClick={() => setModalOpen(true)}>
Create
</button>
<CreateModal isOpen={modalOpen} closeModal={() => setModalOpen(false)} />
</div>
);
}
149 changes: 0 additions & 149 deletions components/DowncaseMigrator.jsx

This file was deleted.

Loading