Skip to content

Commit

Permalink
Remove redundant v-if from menu (#1362)
Browse files Browse the repository at this point in the history
  • Loading branch information
itbm authored Aug 21, 2023
1 parent cfb6f3c commit 009e5e9
Showing 1 changed file with 30 additions and 32 deletions.
62 changes: 30 additions & 32 deletions stubs/inertia/resources/js/Layouts/AppLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,41 +73,39 @@ const logout = () => {
<template #content>
<div class="w-60">
<!-- Team Management -->
<template v-if="$page.props.jetstream.hasTeamFeatures">
<div class="block px-4 py-2 text-xs text-gray-400">
Manage Team
</div>

<!-- Team Settings -->
<DropdownLink :href="route('teams.show', $page.props.auth.user.current_team)">
Team Settings
</DropdownLink>

<DropdownLink v-if="$page.props.jetstream.canCreateTeams" :href="route('teams.create')">
Create New Team
</DropdownLink>

<!-- Team Switcher -->
<template v-if="$page.props.auth.user.all_teams.length > 1">
<div class="border-t border-gray-200 dark:border-gray-600" />

<div class="block px-4 py-2 text-xs text-gray-400">
Manage Team
Switch Teams
</div>

<!-- Team Settings -->
<DropdownLink :href="route('teams.show', $page.props.auth.user.current_team)">
Team Settings
</DropdownLink>

<DropdownLink v-if="$page.props.jetstream.canCreateTeams" :href="route('teams.create')">
Create New Team
</DropdownLink>

<!-- Team Switcher -->
<template v-if="$page.props.auth.user.all_teams.length > 1">
<div class="border-t border-gray-200 dark:border-gray-600" />

<div class="block px-4 py-2 text-xs text-gray-400">
Switch Teams
</div>

<template v-for="team in $page.props.auth.user.all_teams" :key="team.id">
<form @submit.prevent="switchToTeam(team)">
<DropdownLink as="button">
<div class="flex items-center">
<svg v-if="team.id == $page.props.auth.user.current_team_id" class="mr-2 h-5 w-5 text-green-400" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>

<div>{{ team.name }}</div>
</div>
</DropdownLink>
</form>
</template>
<template v-for="team in $page.props.auth.user.all_teams" :key="team.id">
<form @submit.prevent="switchToTeam(team)">
<DropdownLink as="button">
<div class="flex items-center">
<svg v-if="team.id == $page.props.auth.user.current_team_id" class="mr-2 h-5 w-5 text-green-400" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>

<div>{{ team.name }}</div>
</div>
</DropdownLink>
</form>
</template>
</template>
</div>
Expand Down

0 comments on commit 009e5e9

Please # to comment.