35 lines
1.4 KiB
Haskell
35 lines
1.4 KiB
Haskell
|
|
module Web.View.ApiKeys.New where
|
||
|
|
|
||
|
|
import Web.Types
|
||
|
|
import Generated.Types
|
||
|
|
import IHP.Prelude
|
||
|
|
import IHP.ViewPrelude
|
||
|
|
|
||
|
|
data NewView = NewView
|
||
|
|
{ apiKey :: !ApiKey
|
||
|
|
, consumer :: !ApiConsumer
|
||
|
|
}
|
||
|
|
|
||
|
|
instance View NewView where
|
||
|
|
html NewView { .. } = [hsx|
|
||
|
|
<div class="max-w-lg">
|
||
|
|
<h1 class="text-2xl font-semibold mb-2">New API Key</h1>
|
||
|
|
<p class="text-sm text-gray-500 mb-6">For consumer: <strong>{consumer.name}</strong></p>
|
||
|
|
<form method="POST" action={CreateApiKeyAction} class="space-y-4">
|
||
|
|
{hiddenField #id}
|
||
|
|
<input type="hidden" name="apiConsumerId" value={show consumer.id} />
|
||
|
|
<div>
|
||
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">Scopes (space-separated)</label>
|
||
|
|
{textField #scopes}
|
||
|
|
<p class="text-xs text-gray-400 mt-1">e.g. framework:read hub:dev-hub:read hub:dev-hub:write</p>
|
||
|
|
</div>
|
||
|
|
<div class="pt-2 flex gap-3">
|
||
|
|
<button type="submit" class="bg-indigo-600 text-white text-sm font-medium px-4 py-2 rounded hover:bg-indigo-700">
|
||
|
|
Generate Key
|
||
|
|
</button>
|
||
|
|
<a href={ShowApiConsumerAction consumer.id} class="text-sm text-gray-500 px-4 py-2 hover:text-gray-700">Cancel</a>
|
||
|
|
</div>
|
||
|
|
</form>
|
||
|
|
</div>
|
||
|
|
|]
|