Add wish details actions template

This commit is contained in:
grandeljay 2022-12-11 14:44:32 +01:00
parent 4ecb912233
commit cd9c9ded2b
2 changed files with 104 additions and 0 deletions

View file

@ -13,6 +13,11 @@
max-height: 100%; max-height: 100%;
} }
} }
@media (prefers-color-scheme: dark) {
.ui.modal.wish-details .wish-image {
filter: brightness(80%);
}
}
.ui.modal.wish-details .wish-image:has(.ui.placeholder) { .ui.modal.wish-details .wish-image:has(.ui.placeholder) {
height: 40vh; height: 40vh;
@ -32,3 +37,49 @@
.ui.modal.wish-details .wish-image:has(.ui.placeholder) + .description { .ui.modal.wish-details .wish-image:has(.ui.placeholder) + .description {
padding-left: 2em; padding-left: 2em;
} }
/** Actions */
.ui.modal.wish-details > .actions {
display: flex;
flex-flow: row nowrap;
gap: 0.25em;
padding: 1rem !important;
}
.ui.modal.wish-details > .actions .button {
margin: 0;
flex: 1 1 auto;
}
@media (max-width: 1023.9px) {
.ui.modal.wish-details > .actions .button {
padding: 0.78571429em !important;
}
}
@media (min-width: 1024px) {
.ui.modal.wish-details > .actions .button {
flex: 0 1 auto;
}
}
.ui.modal.wish-details > .actions .button i {
display: contents;
}
@media (min-width: 768px) {
.ui.modal.wish-details > .actions .button i {
display: none;
}
}
@media (min-width: 1024px) {
.ui.modal.wish-details > .actions .button i {
display: inline;
}
}
.ui.modal.wish-details > .actions .button span {
display: none;
}
@media (min-width: 768px) {
.ui.modal.wish-details > .actions .button span {
display: inline;
}
}

View file

@ -242,5 +242,58 @@ namespace wishthis;
</div> </div>
</div> </div>
</div> </div>
<div class="actions">
<?php
/** Determine if current user is wishlist owner */
$url = new URL($_SERVER['REQUEST_URI']);
$wishlist_id = $_GET['id'] ?? $_GET['hash'];
$wishlist = new Wishlist($wishlist_id);
$userIsCurrent = $_SESSION['user']->isLoggedIn()
&& $_SESSION['user']->id === $wishlist->user;
?>
<?php if ($userIsCurrent) { ?>
<button class="ui disabled primary labeled icon button wish-fulfilled">
<i class="check icon"></i>
<span><?= __('Mark as fulfilled') ?></span>
</button>
<?php } else { ?>
<button class="ui disabled primary labeled icon button wish-fulfil">
<i class="gift icon"></i>
<span><?= __('Fulfil wish') ?></span>
</button>
<?php } ?>
<a class="ui disabled labeled icon button wish-visit">
<i class="external icon"></i>
<span><?= __('Visit') ?></span>
</a>
<?php if ($userIsCurrent) { ?>
<div class="ui disabled labeled icon top left pointing dropdown button wish-options">
<i class="cog icon"></i>
<span class="text"><?= __('Options') ?></span>
<div class="menu">
<button class="item disabled wish-edit">
<i class="pen icon"></i>
<span><?= __('Edit') ?></span>
</button>
<button class="item disabled wish-delete">
<i class="trash icon"></i>
<span><?= __('Delete') ?></span>
</button>
</div>
</div>
<?php } ?>
<button class="ui cancel labeled icon button wish-close">
<i class="close icon"></i>
<span><?= __('Close') ?></span>
</button>
</div>
</div> </div>
</template> </template>