-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
50 changed files
with
176 additions
and
1,000 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { HeaderDr } from "@/components/ui/header.dr" | ||
import { dictionaryRequirements } from "@/lib/utils/dictionary" | ||
|
||
export const StoresContentDr = dictionaryRequirements( | ||
{ | ||
stores: true, | ||
search: true, | ||
addStore: true, | ||
storeRemote: true, | ||
storeRemoteExample: true, | ||
close: true, | ||
save: true, | ||
}, | ||
HeaderDr | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
"use client" | ||
|
||
import { useState } from "react" | ||
|
||
import { Plus } from "lucide-react" | ||
|
||
import Header from "@/components/ui/header" | ||
import ItemCard from "@/components/ui/item-card" | ||
import { ModalHeader } from "@/components/ui/modal" | ||
import { TDictionary } from "@/lib/langs" | ||
import { trpc } from "@/lib/trpc/client" | ||
import { RouterOutputs } from "@/lib/trpc/utils" | ||
import { gitRemoteToName } from "@/lib/utils/client-utils" | ||
import { Button } from "@nextui-org/button" | ||
import { Input } from "@nextui-org/input" | ||
import { Modal, ModalBody, ModalContent, ModalFooter } from "@nextui-org/modal" | ||
|
||
import { StoresContentDr } from "./content.dr" | ||
|
||
export default function StoresContent({ | ||
ssrConfiguration, | ||
dictionary, | ||
}: { | ||
ssrConfiguration: RouterOutputs["configuration"]["getConfiguration"] | ||
dictionary: TDictionary<typeof StoresContentDr> | ||
}) { | ||
const configuration = trpc.configuration.getConfiguration.useQuery(undefined, { | ||
initialData: ssrConfiguration, | ||
}) | ||
|
||
const [isAddStoreOpen, setIsAddStoreOpen] = useState(false) | ||
const [newStoreName, setNewStoreName] = useState("") | ||
|
||
const utils = trpc.useUtils() | ||
const updateConfigurationMutation = trpc.configuration.updateConfiguration.useMutation({ | ||
onSuccess: async () => { | ||
await utils.configuration.invalidate() | ||
}, | ||
}) | ||
const onAddStore = async (e: React.FormEvent) => { | ||
e.preventDefault() | ||
if (!newStoreName) return | ||
await updateConfigurationMutation.mutateAsync({ | ||
configuration: { | ||
...configuration.data.configuration, | ||
stores: Array.from(new Set([...(configuration.data.configuration.stores ?? []), newStoreName])), | ||
}, | ||
}) | ||
setIsAddStoreOpen(false) | ||
setNewStoreName("") | ||
} | ||
|
||
const isPending = updateConfigurationMutation.isPending | ||
|
||
return ( | ||
<> | ||
<Header | ||
title={dictionary.stores} | ||
dictionary={dictionary} | ||
actions={ | ||
<Button color="primary" onPress={() => setIsAddStoreOpen(true)} isLoading={isPending}> | ||
<Plus className="size-4 shrink-0" /> | ||
{dictionary.addStore} | ||
</Button> | ||
} | ||
/> | ||
<ul className="flex flex-1 flex-col gap-2"> | ||
{(configuration.data.configuration.stores ?? []).map((storeRemote) => ( | ||
<ItemCard key={storeRemote} id={storeRemote} title={gitRemoteToName(storeRemote)} description={storeRemote} /> | ||
))} | ||
</ul> | ||
<Modal isOpen={isAddStoreOpen} onOpenChange={setIsAddStoreOpen}> | ||
<ModalContent> | ||
{(onClose) => ( | ||
<> | ||
<ModalHeader className="flex flex-col gap-1">{dictionary.addStore}</ModalHeader> | ||
<form onSubmit={onAddStore}> | ||
<ModalBody> | ||
<Input | ||
label={dictionary.storeRemote} | ||
value={newStoreName} | ||
onValueChange={setNewStoreName} | ||
placeholder={dictionary.storeRemoteExample} | ||
/> | ||
</ModalBody> | ||
<ModalFooter> | ||
<Button variant="light" onPress={onClose} isDisabled={isPending}> | ||
{dictionary.close} | ||
</Button> | ||
<Button color="primary" type="submit" isLoading={isPending}> | ||
{dictionary.save} | ||
</Button> | ||
</ModalFooter> | ||
</form> | ||
</> | ||
)} | ||
</ModalContent> | ||
</Modal> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import Section from "@/components/ui/section" | ||
import { getDictionary } from "@/lib/langs" | ||
import { serverTrpc } from "@/lib/trpc/server" | ||
import { dictionaryRequirements } from "@/lib/utils/dictionary" | ||
import { extractLocale } from "@/lib/utils/server-utils" | ||
|
||
import StoresContent from "./content" | ||
import { StoresContentDr } from "./content.dr" | ||
|
||
export default async function Stores() { | ||
const locale = extractLocale() | ||
const dictionary = await getDictionary(locale, dictionaryRequirements(StoresContentDr)) | ||
const ssrConfiguration = await serverTrpc.configuration.getConfiguration() | ||
|
||
return ( | ||
<Section> | ||
<StoresContent ssrConfiguration={ssrConfiguration} dictionary={dictionary} /> | ||
</Section> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -237,5 +237,10 @@ | |
"pluginSettings": "Plugin settings", | ||
"apply": "Apply", | ||
"configurationApplied": "Configuration applied", | ||
"search": "Search" | ||
"search": "Search", | ||
"stores": "Stores", | ||
"store": "Store", | ||
"addStore": "Add store", | ||
"storeRemote": "Store URL (git)", | ||
"storeRemoteExample": "[email protected]:rharkor/next-boilerplate--store.git" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -237,5 +237,10 @@ | |
"pluginSettings": "Paramètres du plugin", | ||
"apply": "Appliquer", | ||
"configurationApplied": "Configuration appliquée", | ||
"search": "Rechercher" | ||
"search": "Rechercher", | ||
"stores": "Magasins", | ||
"store": "Magasin", | ||
"addStore": "Ajouter un magasin", | ||
"storeRemote": "URL du magasin (git)", | ||
"storeRemoteExample": "[email protected]:rharkor/next-boilerplate--store.git" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Empty file.
11 changes: 0 additions & 11 deletions
11
packages/cli/assets/stores/0/data/plugins/app/empty/config.json
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
packages/cli/assets/stores/0/data/plugins/conventional-commits/default/.git-hooks/commit-msg
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
packages/cli/assets/stores/0/data/plugins/conventional-commits/default/config.json
This file was deleted.
Oops, something went wrong.
43 changes: 0 additions & 43 deletions
43
...i/assets/stores/0/data/plugins/conventional-commits/default/git-conventional-commits.yaml
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.