Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/utils/routes/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ func EnvironmentNew() string {
return fmt.Sprintf("%s/new", EnvironmentBase)
}

func EnvironmentNewCtx(ctx context.Context) string {
return fmt.Sprintf("%s/%s", ProjectCtx(ctx), EnvironmentNew())
}

func EnvironmentCtx(ctx context.Context) string {
environment, _ := request.EnvironmentFrom(ctx)
return fmt.Sprintf("%s/environment/%d", ProjectCtx(ctx), environment.UID)
Expand Down
9 changes: 6 additions & 3 deletions app/web/views/components/venvironment/dropdown.templ
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ templ Dropdown(envs []*types.Environment, selectedEnv int64) {
<div class="min-w-full table">
for _, env := range envs {
<div class="relative flex select-none items-center rounded-sm text-xs outline-none hover:bg-overlay-hover hover:text-strong data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 cursor-pointer w-full">
<a class="w-full flex items-center justify-between mx-2 my-1.5" href={ routes.EnvironmentUID(env.UID) }>
<a
class="w-full flex items-center justify-between mx-2 my-1.5"
href={ routes.EnvironmentCtxUID(ctx, env.UID) }
>
<span class="truncate max-w-60">{ env.Name }</span>
if env.UID== selectedEnv {
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"></path></svg>
Expand All @@ -45,7 +48,7 @@ templ Dropdown(envs []*types.Environment, selectedEnv int64) {
>
<a
class="w-full flex items-center gap-2"
href={ routes.ProjectEnvironment }
href={ routes.ProjectCtx(ctx) + "/" + routes.ProjectEnvironment }
>
<p>Manage Environments</p>
</a>
Expand All @@ -64,7 +67,7 @@ templ Dropdown(envs []*types.Environment, selectedEnv int64) {
>
<a
class="w-full flex items-center gap-2"
href={ routes.EnvironmentNew() }
href={ routes.EnvironmentNewCtx(ctx) }
>
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-plus"><path d="M5 12h14"></path><path d="M12 5v14"></path></svg>
<p>New Environment</p>
Expand Down
Loading