Various fixes

This commit is contained in:
Nassim Jahnke 2022-05-31 19:07:02 +02:00
parent 542a4efbe3
commit 8a5e4edd50
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
8 changed files with 62 additions and 36 deletions

View File

@ -6,7 +6,7 @@ const props = withDefaults(
activeUnderline?: boolean;
}>(),
{
activeUnderline: true,
activeUnderline: false,
to: undefined,
href: undefined,
}

View File

@ -1,3 +1,9 @@
<script setup lang="ts">
import { useI18n } from "vue-i18n";
const i18n = useI18n();
</script>
<template>
<footer class="relative flex items-end mt-10 background-default px-8 pb-2 text-light-10 min-h-10">
<div class="footerContent w-screen">
@ -5,12 +11,16 @@
<p>© 2022 <a href="https://papermc.io/">PaperMC</a></p>
<div class="footerBarLinks flex flex-col md:flex-row">
<router-link :to="{ name: 'guidelines' }" class="flex items-center rounded-md px-6 py-2" hover="text-primary-400 bg-primary-0"
>Resource Guidelines
>{{ i18n.t("hangar.footer.resourceGuidelines") }}
</router-link>
<router-link :to="{ name: 'api' }" class="flex items-center rounded-md px-6 py-2" hover="text-primary-400 bg-primary-0">API </router-link>
<a href="https://github.com/HangarMC" class="flex items-center rounded-md px-6 py-2" hover="text-primary-400 bg-primary-0">GitHub Organization </a>
<router-link :to="{ name: 'api' }" class="flex items-center rounded-md px-6 py-2" hover="text-primary-400 bg-primary-0">{{
i18n.t("hangar.footer.api")
}}</router-link>
<a href="https://github.com/HangarMC" class="flex items-center rounded-md px-6 py-2" hover="text-primary-400 bg-primary-0">{{
i18n.t("hangar.footer.org")
}}</a>
<router-link :to="{ name: 'tos' }" class="flex items-center rounded-md px-6 py-2" hover="text-primary-400 bg-primary-0"
>Terms of Service
>{{ i18n.t("hangar.footer.tos") }}
</router-link>
</div>
</div>

View File

@ -237,7 +237,7 @@ function isRecent(date: string): boolean {
:class="'text-sm flex shadow-0 p-3 pt-2 pr-4 inline-flex items-center ' + (!notification.read ? 'bg-blue-100 dark:bg-slate-700' : '')"
>
<span class="text-lg mr-2">
<IconMdiInformationOutline v-if="notification.type === 'info'" class="text-lightBlue-600" />
<IconMdiInformationOutline v-if="notification.type === 'info'" class="text-sky-600" />
<IconMdiCheck v-else-if="notification.type === 'success'" class="text-lime-600" />
<IconMdiAlertOutline v-else-if="notification.type === 'warning'" class="text-red-600" />
<IconMdiMessageOutline v-else-if="notification.type === 'neutral'" />

View File

@ -29,8 +29,8 @@ async function _submit(close: () => void) {
<template #default="{ on }">
<InputTextarea v-model.trim="message" :label="label" :rows="2" @keydown.enter.prevent="" />
<Button class="mt-2 ml-2" :disabled="loading" @click="_submit(on.click)">{{ i18n.t("general.submit") }}</Button>
<Button button-type="secondary" class="mt-2" v-on="on">{{ i18n.t("general.close") }}</Button>
<Button class="mt-2" :disabled="loading" @click="_submit(on.click)">{{ i18n.t("general.submit") }}</Button>
<Button button-type="secondary" class="mt-2 ml-2" v-on="on">{{ i18n.t("general.close") }}</Button>
</template>
<template #activator="{ on }">
<slot name="activator" :on="on"></slot>

View File

@ -36,6 +36,12 @@
}
},
"hangar": {
"footer": {
"api": "API",
"resourceGuidelines": "Resource Guidelines",
"org": "GitHub Organization",
"tos": "Terms of Service"
},
"projectSearch": {
"query": "Search in {0} projects...",
"sortBy": "Sort by",
@ -304,7 +310,8 @@
"enable": "Enable",
"enableSub": "Enable the donation form for this project",
"subject": "PayPal email or hosted button id",
"subjectSub": "Enter your PayPal email here. Alternatively, you can setup a hosted button on PayPals Website and enter the hosted button id here."
"subjectSub": "Enter your PayPal email here. Alternatively, you can setup a hosted button on PayPals Website and enter the hosted button id here.",
"subjectLabel": "PayPal email or button id"
},
"error": {
"invalidFile": "{0} is an invalid file type",
@ -325,9 +332,9 @@
},
"tabs": {
"general": "General",
"optional": "Optional",
"links": "Links",
"management": "Management",
"donation": "Donation"
"donation": "Donations"
}
},
"discuss": {

View File

@ -42,7 +42,7 @@ const props = defineProps<{
const selectedTab = ref(route.hash.substring(1) || "general");
const tabs = [
{ value: "general", header: i18n.t("project.settings.tabs.general") },
{ value: "optional", header: i18n.t("project.settings.tabs.optional") },
{ value: "links", header: i18n.t("project.settings.tabs.links") },
{ value: "management", header: i18n.t("project.settings.tabs.management") },
{ value: "donation", header: i18n.t("project.settings.tabs.donation") },
];
@ -89,7 +89,7 @@ async function rename() {
content: newName.value,
});
useNotificationStore().success(i18n.t("project.settings.success.rename", [newName.value]));
await router.push(route.params.user + "/" + newSlug);
await router.push("/" + route.params.user + "/" + newSlug);
} catch (e) {
handleRequestError(e, ctx, i18n);
}
@ -121,8 +121,12 @@ async function hardDelete(comment: string) {
}
async function uploadIcon() {
if (!projectIcon.value) {
return;
}
const data = new FormData();
data.append("projectIcon", projectIcon.value!);
data.append("projectIcon", projectIcon.value);
loading.uploadIcon = true;
try {
await useInternalApi(`projects/project/${route.params.user}/${route.params.project}/saveIcon`, true, "post", data);
@ -138,8 +142,8 @@ async function resetIcon() {
await useInternalApi(`projects/project/${route.params.user}/${route.params.project}/resetIcon`, true, "post");
useNotificationStore().success(i18n.t("project.settings.success.resetIcon"));
document
.getElementById("project-icon-preview")!
.setAttribute("src", `${projectIconUrl(props.project.namespace.owner, props.project.namespace.slug)}?noCache=${Math.random()}`);
.getElementById("project-icon-preview")
?.setAttribute("src", `${projectIconUrl(props.project.namespace.owner, props.project.namespace.slug)}?noCache=${Math.random()}`);
await router.go(0);
} catch (e) {
handleRequestError(e, ctx, i18n);
@ -151,11 +155,11 @@ function onFileChange() {
if (projectIcon.value) {
const reader = new FileReader();
reader.onload = (ev) => {
document.getElementById("project-icon-preview")!.setAttribute("src", ev.target!.result as string);
document.getElementById("project-icon-preview")?.setAttribute("src", ev.target?.result as string);
};
reader.readAsDataURL(projectIcon.value);
} else {
document.getElementById("project-icon-preview")!.setAttribute("src", projectIconUrl(props.project.namespace.owner, props.project.namespace.slug));
document.getElementById("project-icon-preview")?.setAttribute("src", projectIconUrl(props.project.namespace.owner, props.project.namespace.slug));
}
}
@ -204,8 +208,18 @@ useHead(
:rules="[required(), maxLength()(backendData.validations?.project?.desc?.max)]"
/>
</ProjectSettingsSection>
<ProjectSettingsSection title="project.settings.forum">
<!-- todo: forums integration -->
<!--<ProjectSettingsSection title="project.settings.forum">
<InputCheckbox v-model="form.settings.forumSync" :label="i18n.t('project.settings.forumSub')" />
</ProjectSettingsSection>-->
<ProjectSettingsSection title="project.settings.keywords" description="project.settings.keywordsSub">
<InputTag
v-model="form.settings.keywords"
counter
:maxlength="backendData.validations.project.keywords.max"
:label="i18n.t('project.new.step3.keywords')"
:rules="[required(), maxLength()(backendData.validations.project.keywords.max)]"
/>
</ProjectSettingsSection>
<ProjectSettingsSection>
<div class="grid grid-cols-3 grid-rows-[1fr,1fr,min-content] gap-2 w-full">
@ -236,16 +250,7 @@ useHead(
</div>
</ProjectSettingsSection>
</template>
<template #optional>
<ProjectSettingsSection title="project.settings.keywords" description="project.settings.keywordsSub">
<InputTag
v-model="form.settings.keywords"
counter
:maxlength="backendData.validations.project.keywords.max"
:label="i18n.t('project.new.step3.keywords')"
:rules="[required(), maxLength()(backendData.validations.project.keywords.max)]"
/>
</ProjectSettingsSection>
<template #links>
<ProjectSettingsSection title="project.settings.homepage" description="project.settings.homepageSub">
<InputText v-model.trim="form.settings.homepage" :label="i18n.t('project.new.step3.homepage')" :rules="[url()]"></InputText>
</ProjectSettingsSection>
@ -296,7 +301,7 @@ useHead(
>
<TextAreaModal :title="i18n.t('project.settings.delete')" :label="i18n.t('general.comment')" :submit="softDelete">
<template #activator="{ on }">
<Button v-on="on">{{ i18n.t("project.settings.delete") }}</Button>
<Button button-type="red" v-on="on">{{ i18n.t("project.settings.delete") }}</Button>
</template>
</TextAreaModal>
</ProjectSettingsSection>
@ -308,17 +313,21 @@ useHead(
>
<TextAreaModal :title="i18n.t('project.settings.hardDelete')" :label="i18n.t('general.comment')" :submit="hardDelete">
<template #activator="{ on }">
<Button v-on="on">{{ i18n.t("project.settings.hardDelete") }}</Button>
<Button button-type="red" v-on="on">{{ i18n.t("project.settings.hardDelete") }}</Button>
</template>
</TextAreaModal>
</ProjectSettingsSection>
</template>
<template #donation>
<ProjectSettingsSection title="project.settings.donation.enable" description="project.settings.donation.enableSub">
<InputCheckbox v-model="form.settings.donation.enable" />
<ProjectSettingsSection title="project.settings.donation.enable">
<InputCheckbox v-model="form.settings.donation.enable" :label="i18n.t('project.settings.donation.enableSub')" />
</ProjectSettingsSection>
<ProjectSettingsSection title="project.settings.donation.subject" description="project.settings.donation.subjectSub">
<InputText v-model="form.settings.donation.subject" :rules="[requiredIf()(form.settings.donation.enable)]" />
<InputText
v-model="form.settings.donation.subject"
:label="i18n.t('project.settings.donation.subjectLabel')"
:rules="[requiredIf()(form.settings.donation.enable)]"
/>
</ProjectSettingsSection>
</template>
</Tabs>

View File

@ -112,7 +112,7 @@ async function updateInvite(invite: Invite, status: "accept" | "decline" | "unac
<Card v-for="notification in filteredNotifications" :key="notification.id" :class="'text-' + notification.type + ' flex shadow-0'">
<div class="inline-flex items-center">
<span class="text-lg mr-2">
<IconMdiInformationOutline v-if="notification.type === 'info'" class="text-lightBlue-600" />
<IconMdiInformationOutline v-if="notification.type === 'info'" class="text-sky-600" />
<IconMdiCheck v-else-if="notification.type === 'success'" class="text-lime-600" />
<IconMdiAlertOutline v-else-if="notification.type === 'warning'" class="text-red-600" />
<IconMdiMessageOutline v-else-if="notification.type === 'neutral'" />

View File

@ -44,7 +44,7 @@ export default defineConfig({
800: "#00102F",
900: "#000817",
},
lightBlue: colors.lightBlue,
sky: colors.sky,
blue: colors.blue,
lime: colors.lime,
slate: colors.slate,