Skip to content

Commit

Permalink
version 0.9.1012
Browse files Browse the repository at this point in the history
  • Loading branch information
jp-cen committed Dec 14, 2024
1 parent 5bdb975 commit eae94dd
Show file tree
Hide file tree
Showing 35 changed files with 2,979 additions and 286 deletions.
326 changes: 169 additions & 157 deletions main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "make-md",
"name": "MAKE.md",
"version": "0.9.1011",
"version": "0.9.1012",
"minAppVersion": "0.16.0",
"description": "Make.md brings powerful and modern note-taking features to Obsidian. Capture, organize and connect information with more flexibility without any code.",
"author": "MAKE.md",
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "make-md",
"version": "0.9.1007",
"version": "0.9.1012",
"description": "make.md",
"main": "main.js",
"scripts": {
Expand All @@ -27,6 +27,7 @@
"@types/react-transition-group": "^4.4.10",
"@types/react-virtualized-auto-sizer": "^1.0.1",
"@types/react-window": "^1.8.5",
"@types/rrule": "^2.2.9",
"@types/sql.js": "^1.4.4",
"@typescript-eslint/eslint-plugin": "^5.57.1",
"@typescript-eslint/parser": "^5.57.1",
Expand Down Expand Up @@ -86,6 +87,7 @@
"react-dropzone": "^14.2.3",
"react-error-boundary": "^4.0.13",
"react-transition-group": "^4.4.5",
"rrule": "^2.8.1",
"sql.js": "1.8.0",
"use-long-press": "^3.2.0",
"vaul": "github:make-md/vaul"
Expand Down
4 changes: 3 additions & 1 deletion src/core/react/components/Blink/Blink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ export const openBlinkModal = (
superstate: Superstate,
mode: BlinkMode,
win: Window,
onSelect?: (link: string) => void
onSelect?: (link: string) => void,
parentSpace?: string
) => {
superstate.ui.openPalette(
<BlinkComponent
superstate={superstate}
mode={mode}
onSelect={onSelect}
parentSpace={parentSpace}
></BlinkComponent>,
win,
"mk-blink-modal"
Expand Down
37 changes: 34 additions & 3 deletions src/core/react/components/Blink/BlinkComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const BlinkComponent = (props: {
mode: BlinkMode;
onSelect?: (path: string) => void;
hide?: () => void;
parentSpace?: string;
}) => {
const [previewPath, setPreviewPath] = useState<string>(null);
const [showBlink, setShowBlink] = useState(false);
Expand Down Expand Up @@ -76,6 +77,18 @@ export const BlinkComponent = (props: {
label: pathState.name,
};
};
const parentChildren = props.parentSpace
? [
{
type: "section",
label: "Items",
},
...[...props.superstate.spacesMap.getInverse(props.parentSpace)]
.map((f) => props.superstate.pathsIndex.get(f))
.filter((f) => f && !f.hidden)
.map((f) => pathToBlinkItem(f)),
]
: [];
const recentPaths = [
{
type: "section",
Expand All @@ -88,12 +101,14 @@ export const BlinkComponent = (props: {
.map((f) => pathToBlinkItem(f)),
];

const [suggestions, setFilteredPaths] = useState<BlinkItem[]>(recentPaths);
const [suggestions, setFilteredPaths] = useState<BlinkItem[]>(
props.parentSpace ? parentChildren : recentPaths
);

useEffect(() => {
const runQuery = (path: string, _queries: SpaceDefGroup[]) => {
if (path.length == 0 && query.length == 0) {
setFilteredPaths(recentPaths);
setFilteredPaths(props.parentSpace ? parentChildren : recentPaths);
return;
}

Expand Down Expand Up @@ -184,6 +199,20 @@ export const BlinkComponent = (props: {
if (!item) return;
if (item.type == "section") return;
if (item.type == "new-note") {
if (props.parentSpace) {
const parentSpace = props.superstate.spacesIndex.get(props.parentSpace);
if (parentSpace) {
newPathInSpace(props.superstate, parentSpace, "md", query).then(
(f) => {
if (props.mode == BlinkMode.Open) {
props.onSelect(f);
}
props.hide();
}
);
return;
}
}
defaultSpace(
props.superstate,
props.superstate.pathsIndex.get(props.superstate.ui.activePath)
Expand All @@ -198,7 +227,9 @@ export const BlinkComponent = (props: {
return;
}
if (item.type == "new-space") {
const pathState = props.superstate.pathsIndex.get("/");
const pathState =
props.superstate.pathsIndex.get(props.parentSpace) ??
props.superstate.pathsIndex.get("/");
const newName = query.replace(/\//g, "");
const parentPath =
pathState?.subtype == "folder"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import { formatDate } from "core/utils/date";
import { Superstate } from "makemd-core";
import React from "react";

export const CalendarHeaderView = (props: {
superstate: Superstate;
date: Date;
mode: "day" | "week" | "month";
setDate: (date: Date) => void;
}) => {
const monthString = formatDate(
props.superstate,
props.date,
props.mode == "day" ? "MMMM d" : "MMMM"
);
return (
<div className="mk-calendar-header">
<div className="mk-calendar-header-title">
<span>{monthString}</span>
{formatDate(props.superstate, props.date, "yyyy")}
</div>
<span></span>
<button
dangerouslySetInnerHTML={{
__html: props.superstate.ui.getSticker("ui//chevron-left"),
}}
onClick={() => {
if (props.mode == "day") {
props.setDate(
new Date(props.date.setDate(props.date.getDate() - 1))
);
return;
} else if (props.mode == "week") {
props.setDate(
new Date(props.date.setDate(props.date.getDate() - 7))
);
return;
}
props.setDate(
new Date(props.date.setMonth(props.date.getMonth() - 1))
);
}}
></button>
<button
onClick={() => {
props.setDate(new Date());
}}
>
Today
</button>
<button
onClick={() => {
if (props.mode == "day") {
props.setDate(
new Date(props.date.setDate(props.date.getDate() + 1))
);
return;
}
if (props.mode == "week") {
props.setDate(
new Date(props.date.setDate(props.date.getDate() + 7))
);
return;
}
props.setDate(
new Date(props.date.setMonth(props.date.getMonth() + 1))
);
}}
dangerouslySetInnerHTML={{
__html: props.superstate.ui.getSticker("ui//chevron-right"),
}}
></button>
</div>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from "react";
export const DayGutter = (props: {
hourHeight: number;
startHour: number;
endHour: number;
allDay?: boolean;
}) => {
return (
<div className="mk-day-view-gutter">
{props.allDay && <div className="mk-day-view-hour-title">all day</div>}
{Array.from({ length: props.endHour - props.startHour + 1 }).map(
(_, index) => {
const hour = index + props.startHour;
return (
<div key={hour} className="mk-day-view-hour-title">
<span>{hour % 12 === 0 ? 12 : hour % 12}</span>{" "}
{hour < 12 ? "AM" : "PM"}
</div>
);
}
)}
</div>
);
};
Loading

0 comments on commit eae94dd

Please sign in to comment.