Formatting

This commit is contained in:
Kiril Videlov 2023-02-24 12:43:18 +01:00
parent be901c11a3
commit e8a77b7d50
2 changed files with 233 additions and 271 deletions

View File

@ -1,53 +1,46 @@
<script lang="ts"> <script lang="ts">
import "../app.postcss"; import '../app.postcss';
import { Toaster } from "svelte-french-toast"; import { Toaster } from 'svelte-french-toast';
import type { LayoutData } from "./$types"; import type { LayoutData } from './$types';
import { BackForwardButtons } from "$lib/components"; import { BackForwardButtons } from '$lib/components';
import { setContext } from "svelte"; import { setContext } from 'svelte';
import { writable } from "svelte/store"; import { writable } from 'svelte/store';
import Breadcrumbs from "$lib/components/Breadcrumbs.svelte"; import Breadcrumbs from '$lib/components/Breadcrumbs.svelte';
export let data: LayoutData; export let data: LayoutData;
const { user, posthog } = data; const { user, posthog } = data;
setContext("project", writable(null)); setContext('project', writable(null));
setContext("session", writable(null)); setContext('session', writable(null));
user.subscribe(posthog.identify); user.subscribe(posthog.identify);
</script> </script>
<div class="flex flex-col h-0 min-h-full bg-zinc-800 text-zinc-400"> <div class="flex flex-col h-0 min-h-full bg-zinc-800 text-zinc-400">
<header <header
data-tauri-drag-region data-tauri-drag-region
class="sticky top-0 z-50 flex flex-row items-center h-8 overflow-hidden border-b select-none text-zinc-400 border-zinc-700 bg-zinc-900 " class="sticky top-0 z-50 flex flex-row items-center h-8 overflow-hidden border-b select-none text-zinc-400 border-zinc-700 bg-zinc-900 "
> >
<div class="ml-24"> <div class="ml-24">
<BackForwardButtons /> <BackForwardButtons />
</div> </div>
<div class="ml-6"><Breadcrumbs /></div> <div class="ml-6"><Breadcrumbs /></div>
<div class="flex-grow" /> <div class="flex-grow" />
<a <a href="/users/" class="flex items-center gap-2 mr-4 font-medium hover:text-zinc-200">
href="/users/" {#if $user}
class="flex items-center gap-2 mr-4 font-medium hover:text-zinc-200" {#if $user.picture}
> <img class="inline-block w-6 h-6 rounded-full" src={$user.picture} alt="Avatar" />
{#if $user} {/if}
{#if $user.picture} <span>{$user.name}</span>
<img {:else}
class="inline-block w-6 h-6 rounded-full" <span>Connect to GitButler Cloud</span>
src={$user.picture} {/if}
alt="Avatar" </a>
/> </header>
{/if}
<span>{$user.name}</span>
{:else}
<span>Connect to GitButler Cloud</span>
{/if}
</a>
</header>
<div class="flex-grow bg-zinc-800 text-zinc-400"> <div class="flex-grow bg-zinc-800 text-zinc-400">
<slot /> <slot />
</div> </div>
<Toaster /> <Toaster />
</div> </div>

View File

@ -1,241 +1,210 @@
<script lang="ts"> <script lang="ts">
import FaFolderOpen from "svelte-icons/fa/FaFolderOpen.svelte"; import FaFolderOpen from 'svelte-icons/fa/FaFolderOpen.svelte';
import { open } from "@tauri-apps/api/dialog"; import { open } from '@tauri-apps/api/dialog';
import type { LayoutData } from "./$types"; import type { LayoutData } from './$types';
export let data: LayoutData; export let data: LayoutData;
const { projects } = data; const { projects } = data;
const onAddLocalRepositoryClick = async () => { const onAddLocalRepositoryClick = async () => {
const selectedPath = await open({ const selectedPath = await open({
directory: true, directory: true,
recursive: true, recursive: true
}); });
if (selectedPath === null) return; if (selectedPath === null) return;
if (Array.isArray(selectedPath) && selectedPath.length !== 1) return; if (Array.isArray(selectedPath) && selectedPath.length !== 1) return;
const projectPath = Array.isArray(selectedPath) const projectPath = Array.isArray(selectedPath) ? selectedPath[0] : selectedPath;
? selectedPath[0]
: selectedPath;
const projectExists = $projects.some((p) => p.path === projectPath); const projectExists = $projects.some((p) => p.path === projectPath);
if (projectExists) return; if (projectExists) return;
await projects.add({ path: projectPath }); await projects.add({ path: projectPath });
}; };
</script> </script>
<div class="w-full h-full p-8"> <div class="w-full h-full p-8">
<div class="flex flex-col h-full"> <div class="flex flex-col h-full">
{#if $projects.length == 0} {#if $projects.length == 0}
<div class="h-fill grid grid-cols-2 gap-4 items-center h-full"> <div class="h-fill grid grid-cols-2 gap-4 items-center h-full">
<!-- right box, welcome text --> <!-- right box, welcome text -->
<div class="flex flex-col space-y-4 content-center p-4"> <div class="flex flex-col space-y-4 content-center p-4">
<div class="text-xl text-zinc-300 p-0 m-0"> <div class="text-xl text-zinc-300 p-0 m-0">
<div class="font-bold">Welcome to GitButler.</div> <div class="font-bold">Welcome to GitButler.</div>
<div class="text-lg text-zinc-300 mb-1"> <div class="text-lg text-zinc-300 mb-1">More than just version control.</div>
More than just version control. </div>
</div> <div class="">
</div> GitButler is a tool to help you manage all the local work you do on your code projects.
<div class=""> </div>
GitButler is a tool to help you manage all the local <div class="">
work you do on your code projects. Think of us as a <strong>code concierge</strong>, a smart assistant for all the coding
</div> related tasks you need to do every day.
<div class=""> </div>
Think of us as a <strong>code concierge</strong>, a <ul class="text-zinc-400 pt-2 pb-4 space-y-4">
smart assistant for all the coding related tasks you <li class="flex flex-row space-x-3">
need to do every day. <svg
</div> xmlns="http://www.w3.org/2000/svg"
<ul class="text-zinc-400 pt-2 pb-4 space-y-4"> fill="none"
<li class="flex flex-row space-x-3"> viewBox="0 0 24 24"
<svg stroke-width="1.5"
xmlns="http://www.w3.org/2000/svg" stroke="currentColor"
fill="none" class="w-8 h-8 flex-none"
viewBox="0 0 24 24" >
stroke-width="1.5" <path
stroke="currentColor" stroke-linecap="round"
class="w-8 h-8 flex-none" stroke-linejoin="round"
> d="M21 16.811c0 .864-.933 1.405-1.683.977l-7.108-4.062a1.125 1.125 0 010-1.953l7.108-4.062A1.125 1.125 0 0121 8.688v8.123zM11.25 16.811c0 .864-.933 1.405-1.683.977l-7.108-4.062a1.125 1.125 0 010-1.953L9.567 7.71a1.125 1.125 0 011.683.977v8.123z"
<path />
stroke-linecap="round" </svg>
stroke-linejoin="round"
d="M21 16.811c0 .864-.933 1.405-1.683.977l-7.108-4.062a1.125 1.125 0 010-1.953l7.108-4.062A1.125 1.125 0 0121 8.688v8.123zM11.25 16.811c0 .864-.933 1.405-1.683.977l-7.108-4.062a1.125 1.125 0 010-1.953L9.567 7.71a1.125 1.125 0 011.683.977v8.123z"
/>
</svg>
<span class="text-zinc-200" <span class="text-zinc-200"
>Automatically recording everything you do in >Automatically recording everything you do in any of your butlered projects.</span
any of your butlered projects.</span >
> </li>
</li> <li class="flex flex-row space-x-3">
<li class="flex flex-row space-x-3"> <svg
<svg xmlns="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg" fill="none"
fill="none" viewBox="0 0 24 24"
viewBox="0 0 24 24" stroke-width="1.5"
stroke-width="1.5" stroke="currentColor"
stroke="currentColor" class="w-8 h-8 flex-none"
class="w-8 h-8 flex-none" >
> <path
<path stroke-linecap="round"
stroke-linecap="round" stroke-linejoin="round"
stroke-linejoin="round" d="M21 11.25v8.25a1.5 1.5 0 01-1.5 1.5H5.25a1.5 1.5 0 01-1.5-1.5v-8.25M12 4.875A2.625 2.625 0 109.375 7.5H12m0-2.625V7.5m0-2.625A2.625 2.625 0 1114.625 7.5H12m0 0V21m-8.625-9.75h18c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125h-18c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125z"
d="M21 11.25v8.25a1.5 1.5 0 01-1.5 1.5H5.25a1.5 1.5 0 01-1.5-1.5v-8.25M12 4.875A2.625 2.625 0 109.375 7.5H12m0-2.625V7.5m0-2.625A2.625 2.625 0 1114.625 7.5H12m0 0V21m-8.625-9.75h18c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125h-18c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125z" />
/> </svg>
</svg>
<span class="text-zinc-200" <span class="text-zinc-200"
>Simplifying all your Git work, including >Simplifying all your Git work, including committing, branching and pushing, to be
committing, branching and pushing, to be easy easy and intuitive.
and intuitive. </span>
</span> </li>
</li> <li class="flex flex-row space-x-3">
<li class="flex flex-row space-x-3"> <svg
<svg xmlns="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg" fill="none"
fill="none" viewBox="0 0 24 24"
viewBox="0 0 24 24" stroke-width="1.5"
stroke-width="1.5" stroke="currentColor"
stroke="currentColor" class="w-8 h-8 flex-none"
class="w-8 h-8 flex-none" >
> <path
<path stroke-linecap="round"
stroke-linecap="round" stroke-linejoin="round"
stroke-linejoin="round" d="M15.75 15.75l-2.489-2.489m0 0a3.375 3.375 0 10-4.773-4.773 3.375 3.375 0 004.774 4.774zM21 12a9 9 0 11-18 0 9 9 0 0118 0z"
d="M15.75 15.75l-2.489-2.489m0 0a3.375 3.375 0 10-4.773-4.773 3.375 3.375 0 004.774 4.774zM21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
/> </svg>
</svg>
<span class="text-zinc-200" <span class="text-zinc-200"
>Helping you not just search for strings or past >Helping you not just search for strings or past commits, but find useful context in
commits, but find useful context in the story of the story of your code.
your code. </span>
</span> </li>
</li> </ul>
</ul> <div class="pt-6">
<div class="pt-6"> <a
<a target="_blank"
target="_blank" href="https://help.gitbutler.com"
href="https://help.gitbutler.com" class="text-base font-semibold leading-7 text-white bg-zinc-700 px-4 py-3 rounded-lg mt-4"
class="text-base font-semibold leading-7 text-white bg-zinc-700 px-4 py-3 rounded-lg mt-4" >
> Learn more <span aria-hidden="true"></span></a
Learn more <span aria-hidden="true"></span></a >
> </div>
</div> </div>
</div> <!-- left box, add a new project -->
<!-- left box, add a new project --> <div class="text-center">
<div class="text-center"> <svg
<svg class="mx-auto h-12 w-12 text-gray-400"
class="mx-auto h-12 w-12 text-gray-400" fill="none"
fill="none" viewBox="0 0 24 24"
viewBox="0 0 24 24" stroke="currentColor"
stroke="currentColor" aria-hidden="true"
aria-hidden="true" >
> <path
<path vector-effect="non-scaling-stroke"
vector-effect="non-scaling-stroke" stroke-linecap="round"
stroke-linecap="round" stroke-linejoin="round"
stroke-linejoin="round" stroke-width="2"
stroke-width="2" d="M9 13h6m-3-3v6m-9 1V7a2 2 0 012-2h6l2 2h6a2 2 0 012 2v8a2 2 0 01-2 2H5a2 2 0 01-2-2z"
d="M9 13h6m-3-3v6m-9 1V7a2 2 0 012-2h6l2 2h6a2 2 0 012 2v8a2 2 0 01-2 2H5a2 2 0 01-2-2z" />
/> </svg>
</svg> <h3 class="mt-2 text-lg font-semibold text-zinc-300">No projects</h3>
<h3 class="mt-2 text-lg font-semibold text-zinc-300"> <p class="mt-1 text-gray-500">Get started by tracking a project you're working on.</p>
No projects <div class="mt-6">
</h3> <button
<p class="mt-1 text-gray-500"> on:click={onAddLocalRepositoryClick}
Get started by tracking a project you're working on. type="button"
</p> class="inline-flex items-center rounded-md border border-transparent bg-blue-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2"
<div class="mt-6"> >
<button Start Tracking a Project
on:click={onAddLocalRepositoryClick} </button>
type="button" </div>
class="inline-flex items-center rounded-md border border-transparent bg-blue-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2" </div>
> </div>
Start Tracking a Project {:else}
</button> <div class="select-none p-8">
</div> <div class="flex flex-col">
</div> <div class="flex flex-row justify-between">
</div> <div class="text-xl text-zinc-300 mb-1">
{:else} My Projects
<div class="select-none p-8"> <div class="text-lg text-zinc-500 mb-1">
<div class="flex flex-col"> All the projects that I am currently helping you with.
<div class="flex flex-row justify-between"> </div>
<div class="text-xl text-zinc-300 mb-1"> </div>
My Projects <div>
<div class="text-lg text-zinc-500 mb-1"> <button
All the projects that I am currently helping you on:click={onAddLocalRepositoryClick}
with. type="button"
</div> class="inline-flex items-center rounded-md border border-transparent bg-blue-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2"
</div> >
<div> Track a New Project
<button </button>
on:click={onAddLocalRepositoryClick} </div>
type="button" </div>
class="inline-flex items-center rounded-md border border-transparent bg-blue-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2" <div class="h-full max-h-screen overflow-auto">
> <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 mt-4">
Track a New Project {#each $projects as project}
</button> <div class="flex flex-col justify-between space-y-1 bg-zinc-700 rounded-lg shadow">
</div> <div class="px-4 py-4 flex-grow-0">
</div> <a
<div class="h-full max-h-screen overflow-auto"> class="hover:text-zinc-200 text-zinc-300 text-lg"
<div href="/projects/{project.id}/">{project.title}</a
class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 mt-4" >
> <div class="text-zinc-500 font-mono">
{#each $projects as project} {project.path}
<div </div>
class="flex flex-col justify-between space-y-1 bg-zinc-700 rounded-lg shadow" </div>
> <div
<div class="px-4 py-4 flex-grow-0"> class="flex-grow-0 text-zinc-500 font-mono border-t border-zinc-600 bg-zinc-600 rounded-b-lg px-3 py-1"
<a >
class="hover:text-zinc-200 text-zinc-300 text-lg" {#if project.api}
href="/projects/{project.id}/" <div class="flex flex-row items-center space-x-2 ">
>{project.title}</a <div class="w-2 h-2 bg-green-700 rounded-full" />
> <div class="text-zinc-400">syncing</div>
<div class="text-zinc-500 font-mono"> </div>
{project.path} {:else}
</div> <div class="flex flex-row items-center space-x-2 ">
</div> <div class="w-2 h-2 bg-gray-400 rounded-full" />
<div <div class="text-zinc-400">offline</div>
class="flex-grow-0 text-zinc-500 font-mono border-t border-zinc-600 bg-zinc-600 rounded-b-lg px-3 py-1" </div>
> {/if}
{#if project.api} </div>
<div </div>
class="flex flex-row items-center space-x-2 " {/each}
> </div>
<div </div>
class="w-2 h-2 bg-green-700 rounded-full" </div>
/> </div>
<div class="text-zinc-400">
syncing
</div>
</div>
{:else}
<div
class="flex flex-row items-center space-x-2 "
>
<div
class="w-2 h-2 bg-gray-400 rounded-full"
/>
<div class="text-zinc-400">
offline
</div>
</div>
{/if}
</div>
</div>
{/each}
</div>
</div>
</div>
</div>
<div class="absolute bottom-0 left-0 w-full"> <div class="absolute bottom-0 left-0 w-full">
<div <div
class="flex items-center flex-shrink-0 p-4 h-18 border-t select-none border-zinc-700 bg-zinc-900" class="flex items-center flex-shrink-0 p-4 h-18 border-t select-none border-zinc-700 bg-zinc-900"
> >
<div class="text-sm text-zinc-300">Timeline</div> <div class="text-sm text-zinc-300">Timeline</div>
</div> </div>
</div> </div>
{/if} {/if}
</div> </div>
</div> </div>