Skip to content

Commit

Permalink
gist editor: tweak how we create new gist (fixes #4)
Browse files Browse the repository at this point in the history
  • Loading branch information
kjk committed Aug 25, 2024
1 parent e4ce28c commit 6ad6ff1
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 14 deletions.
24 changes: 16 additions & 8 deletions frontend/src/gisteditor/GistEditor.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
import HelpButton from "./HelpButton.svelte";
import GistEditorNav from "./GistEditorNav.svelte";
import GistLine from "./GistLine.svelte";
import CreateGists from "./CreateGists.svelte";
import About from "./About.svelte";
import SelectLangDialog from "./SelectLangDialog.svelte";
// import { tooltip } from "../actions/tooltip.js";
import { tooltip } from "../actions/tooltip.js";
import {
gistsSummary,
localGists,
Expand All @@ -21,7 +20,7 @@
githubUserInfo,
setOnGitHubLogin,
} from "../github_login.js";
import { goToGistById } from "./router";
import { goToCreateNewGist, goToGistById } from "./router";
import { focus } from "../actions/focus";
let showingSelectLang = $state(false);
Expand Down Expand Up @@ -126,6 +125,10 @@
refreshGistsForLoggedUser(true);
}
function createNewTextGist() {
goToCreateNewGist("text");
}
/**
* @param {KeyboardEvent} ev
*/
Expand Down Expand Up @@ -159,11 +162,16 @@
</div>
{/if}

<CreateGists />
{#if true && totalGistsCount > 0}
<div class="relative bg-slate-200 w-[95vw] mx-auto flex mt-2">
<!-- <CreateGists /> -->
<div class="flex flex-row w-[95vw] mx-auto mt-2">
<button
class="mr-4 border border-gray-400 px-2 py-1 hover:bg-gray-100 self-center"
onclick={createNewTextGist}
use:tooltip={"Create new text gist"}>New Gist</button
>
<div class="flex-1 relative bg-slate-200 flex">
<input
class="w-full border-2 border-gray-300 px-2 py-0.5"
class="w-full border border-gray-400 px-2 py-0.5"
use:focus
bind:value={searchTerm}
autocomplete="off"
Expand All @@ -180,7 +188,7 @@
private
</div>
</div>
{/if}
</div>

<!-- svelte-ignore a11y_click_events_have_key_events -->
<!-- svelte-ignore a11y_no_static_element_interactions -->
Expand Down
10 changes: 8 additions & 2 deletions frontend/src/gisteditor/GistEditorNav.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
import Overlay from "../Overlay.svelte";
import About from "./About.svelte";
import { positionModal } from "../actions/positionnode";
import { tooltip } from "../actions/tooltip";
/** @type {Function} */
/** @type {{
onNewGist: Function,
onNewGist: () => void,
}} */
let { onNewGist } = $props();
Expand All @@ -20,7 +21,7 @@
</script>

<div
class="flex items-center mb-2 pt-1 pb-2 border-b justify-between center text-gray-500"
class="flex items-center mb-2 pt-1 pb-2 justify-between center text-gray-500"
>
<div class="flex font-bold text-lg items-center">
<a class="px-1 py-1 mr-1 hover:bg-gray-100" href="/">
Expand All @@ -29,7 +30,12 @@
<div class="mr-2">/</div>
<span class="text-purple-800">Gist</span>
<span class="text-yellow-800 ml-2">Editor</span>
<!-- <button
class="mr-4 ml-4 font-normal px-2 py-1 hover:bg-gray-100 self-center"
use:tooltip={"Create new text gist"}>New Gist</button
> -->
</div>

<button
class="ml-8 px-3 py-1 hover:bg-gray-100"
onclick={() => (showingAbout = !showingAbout)}
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/gisteditor/Login.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
import { goGistEditorHome } from "./router.js";
/** @type {{
gistid: string,
onGoHome: () => void,
onNewGist: () => void,
showTwitter: boolean,
gistid?: string,
onGoHome?: () => void,
onNewGist?: () => void,
showTwitter?: boolean,
}}*/
let {
gistid = "",
Expand Down

0 comments on commit 6ad6ff1

Please sign in to comment.