Skip to content

Commit

Permalink
Merge branch 'master' into migrate-api-to-websocket
Browse files Browse the repository at this point in the history
  • Loading branch information
bperel committed Apr 1, 2024
2 parents 0f78941 + 7554c32 commit 5546fdc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 18 deletions.
8 changes: 0 additions & 8 deletions apps/web/src/components/ContextMenuOwnCollection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,6 @@ let { publicationcode, selectedIssueIdsByIssuenumber } = defineProps<{
}>();
const emit = defineEmits<{
(e: "clear-selection"): void;
(
e: "launch-modal",
options: {
contactMethod: string;
sellerId: number;
},
): void;
(e: "close"): void;
}>();
const { t: $t } = useI18n();
Expand Down
34 changes: 24 additions & 10 deletions apps/web/src/components/IssueList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -319,15 +319,23 @@
:publicationcode="publicationcode"
:selected-issue-ids-by-issuenumber="copiesBySelectedIssuenumber"
@clear-selection="
contextmenuInstance.hide();
contextmenuInstance!.hide();
selected = [];
"
@close="
contextMenuKey = `context-menu-${Math.random()}`;
contextmenuInstance.hide();
contextmenuInstance!.hide();
"
@launch-modal="
emit('launch-modal', { ...$event, selectedIssueIds: issueIds })
v-on="
contextMenuComponentName === 'context-menu-on-sale-by-others'
? {
'launch-modal': () =>
emit(
'launch-modal',
Object.assign({}, $event, { selectedIssueIds: issueIds }),
),
}
: {}
"
/>
</v-contextmenu>
Expand Down Expand Up @@ -367,7 +375,7 @@ const {
customIssues?: issueWithPublicationcode[];
onSaleByOthers?: boolean;
groupUserCopies?: boolean;
contextMenuComponentName?: string;
contextMenuComponentName?: "context-menu-on-sale-by-others";
readonly?: boolean;
}>();
Expand Down Expand Up @@ -415,7 +423,13 @@ const filter = $ref({
missing: true,
possessed: true,
} as { missing: boolean; possessed: boolean });
const contextmenuInstance = $ref(null as unknown | null);
const contextmenuInstance = $ref(
null as {
visible: boolean;
hide: (e?: MouseEvent) => void;
show: (e: MouseEvent) => void;
} | null,
);
let issues = $shallowRef(null as issueWithPublicationCodeAndCopies[] | null);
let userIssuesForPublication = $shallowRef(
null as issueWithPublicationcode[] | null,
Expand Down Expand Up @@ -519,12 +533,12 @@ const showContextMenuOnDoubleClickTouchScreen = (e: MouseEvent) => {
if (clicks === 1) {
timer = setTimeout(() => {
clicks = 0;
contextmenuInstance.hide(e);
contextmenuInstance!.hide(e);
}, doubleClickDelay);
} else if (clicks === 2) {
clearTimeout(timer!);
clicks = 0;
contextmenuInstance.show(e);
contextmenuInstance!.show(e);
}
}
};
Expand All @@ -542,7 +556,7 @@ const getPreselected = () =>
index <= preselectedIndexEnd,
);
const updateSelected = () => {
if (!contextmenuInstance.visible) {
if (!contextmenuInstance?.visible) {
selected = issues!
.map(({ key }) => key || "")
.filter(
Expand All @@ -556,7 +570,7 @@ const updateSelected = () => {
const deletePublicationIssues = async (
issuesToDelete: issueWithPublicationcode[],
) => {
contextmenuInstance.hide();
contextmenuInstance!.hide();
if (!readonly) {
await updateCollectionMultipleIssues({
publicationcode,
Expand Down

0 comments on commit 5546fdc

Please sign in to comment.