Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hellno committed Sep 13, 2023
1 parent 242bf90 commit 2f198a7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
29 changes: 19 additions & 10 deletions src/pages/NewPost/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { useNewPostStore } from "@/stores/useNewPostStore";
import React, { useState } from "react";
import CustomToast from "@/common/components/CustomToast";
import { PlusCircleIcon, TrashIcon } from "@heroicons/react/24/outline";
import * as Tooltip from '@radix-ui/react-tooltip';
import HotkeyTooltipWrapper from "@/common/components/HotkeyTooltipWrapper";

export default function NewPost() {
const [showToast, setShowToast] = useState(false)
Expand All @@ -20,16 +22,23 @@ export default function NewPost() {
<div className="w-full flex items-center justify-between">
<div className="text-gray-100 font-semibold">You have {postDrafts.length} {postDrafts.length !== 1 ? 'drafts' : 'draft'}</div>
<div className="flex ml-8 lg:ml-0">
<button
onClick={() => addNewPostDraft({})}
className={classNames(
"cursor-pointer hover:bg-gray-600 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-zinc-600",
"mr-2 inline-flex items-center rounded-sm bg-gray-700 px-3 py-2 text-sm font-semibold text-white shadow-sm "
)}
>
New draft
<PlusCircleIcon className="ml-1.5 mt-0.5 h-4 w-4 text-gray-100" aria-hidden="true" />
</button>
<Tooltip.Provider delayDuration={50} skipDelayDuration={0}>
<HotkeyTooltipWrapper hotkey={`c`} side="bottom">
<button
onClick={() => addNewPostDraft({})}
className={classNames(
"cursor-pointer hover:bg-gray-600 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-zinc-600",
"mr-2 inline-flex items-center rounded-sm bg-gray-700 px-3 py-2 text-sm font-semibold text-white shadow-sm "
)}
>
New draft
<PlusCircleIcon className="ml-1.5 mt-0.5 h-4 w-4 text-gray-100" aria-hidden="true" />
</button>

</HotkeyTooltipWrapper>
</Tooltip.Provider >


<button
disabled={postDrafts.length === 0}
onClick={() => removeAllPostDrafts()}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export default function Settings() {
{commands.map((command) => (
<div key={`command-${command.name}`} className="px-2 py-4 sm:grid sm:grid-cols-3 sm:gap-4">
<dt className="text-sm font-medium text-gray-100">{command.name}</dt>
<dd className="mt-1 text-sm leading-6 text-gray-200 sm:col-span-1 sm:mt-0">{command.shortcut.replace(/\+/g, ' + ')}</dd>
{command.shortcut && <dd className="mt-1 text-sm leading-6 text-gray-200 sm:col-span-1 sm:mt-0">{command.shortcut.replace(/\+/g, ' + ')}</dd>}
</div>
))}
{/* <div className="px-2 py-4 sm:grid sm:grid-cols-3 sm:gap-4">
Expand Down
2 changes: 1 addition & 1 deletion src/stores/useNewPostStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const mutative = (config) =>
type StoreSet = (fn: (draft: Draft<NewPostStore>) => void) => void;

const store = (set: StoreSet) => ({
drafts: [NewPostDraft],
drafts: [],
isToastOpen: false,
addNewPostDraft: ({ text, parentUrl, parentCastId }: addNewPostDraftProps) => {
set((state) => {
Expand Down

0 comments on commit 2f198a7

Please sign in to comment.