The frontend component of PuffPastry, meant to interface with the backend, which in turn interfaces with the smart contract.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

73 lines
2.2 KiB

  1. <template>
  2. <aside class="sm:flex sm:flex-col sm:w-1/4 bg-gray-600 h-screen">
  3. <nav class="sticky top-0 left-0 flex flex-row w-full h-1/16 justify-between">
  4. <button
  5. class="w-10/12 h-full bg-gray-800 px-5 py-3 text-sm font-bold text-white border-r border-white border-solid uppercase text-center cursor-pointer"
  6. @click="showNewProposalModal"
  7. >
  8. Add Proposal
  9. </button>
  10. <button
  11. class="flex flex-row w-2/12 h-full bg-gray-800 justify-center items-center cursor-pointer"
  12. @click="showFilterModal"
  13. >
  14. <Filter/>
  15. </button>
  16. </nav>
  17. <div class="h-11/12">
  18. <ProposalContainer
  19. v-for="proposal in proposals"
  20. :key="proposal.id"
  21. :proposal="proposal"
  22. :selected="selectedId === proposal.id"
  23. @selected="handleSelection"
  24. />
  25. <LoadingSpinner
  26. v-if="isLoading('proposals')"
  27. identifier="proposals"
  28. />
  29. </div>
  30. </aside>
  31. </template>
  32. <script setup lang="ts">
  33. import ProposalContainer from "./ProposalContainer.vue";
  34. import LoadingSpinner from "./LoadingSpinner.vue";
  35. import {ProposalSelection} from "../types/proposal.ts";
  36. import {useLoading} from "../composables/useLoading.ts";
  37. import ProposalModal from "./modals/ProposalModal.vue";
  38. import {ContentModal, useModal} from "../composables/useModal.ts";
  39. import FilterModal from "./modals/FilterModal.vue";
  40. import Filter from "./icons/Filter.vue";
  41. import {ref} from "vue";
  42. import {ProposalList} from "../generated/typescript";
  43. const { show: showModal } = useModal();
  44. const props = defineProps<{ proposals: ProposalList | undefined }>();
  45. const emit = defineEmits(['update:selection']);
  46. const {isLoading} = useLoading();
  47. const selectedId = ref<number>();
  48. const handleSelection = (proposal: ProposalSelection) => {
  49. const id = proposal.proposal.id;
  50. if (selectedId.value && selectedId.value === id) return;
  51. selectedId.value = id;
  52. emit('update:selection', {proposal: proposal.proposal});
  53. }
  54. const showNewProposalModal = () => {
  55. showModal(ProposalModal as ContentModal);
  56. }
  57. const showFilterModal = () => {
  58. showModal(FilterModal as ContentModal);
  59. }
  60. </script>
  61. <style lang="postcss">
  62. </style>