Skip to content

Commit

Permalink
feat(everything): tiny issues (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
PaiJi authored Jan 27, 2024
1 parent 2dd92e9 commit f6fb3a7
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 40 deletions.
2 changes: 1 addition & 1 deletion next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const nextConfig = {
config.plugins.push(
new webpack.DefinePlugin({
VERSION: JSON.stringify(gitRevisionPlugin.version()),
COMMITHASH: JSON.stringify(gitRevisionPlugin.commithash()),
COMMITHASH: JSON.stringify(gitRevisionPlugin.commithash().slice(0, 7)),
BRANCH: JSON.stringify(gitRevisionPlugin.branch()),
LASTCOMMITDATETIME: JSON.stringify(
gitRevisionPlugin.lastcommitdatetime()
Expand Down
8 changes: 3 additions & 5 deletions src/components/eventCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { BsCalendar2DateFill } from "react-icons/bs";
import Image from "@/components/image";
import clsx from "clsx";
import { sendTrack } from "@/utils/track";
import { getEventCoverUrl } from "@/utils/imageLoader";

export default function EventCard({
event,
Expand All @@ -17,10 +18,7 @@ export default function EventCard({
}) {
const [isWiderImage, setIsWiderImage] = useState(true);

const finalEventCoverImage =
event.coverUrl ||
event.posterUrl?.[0] ||
`https://images.furrycons.cn/fec-event-default-cover.png`;
const finalEventCoverImage = getEventCoverUrl(event);
const isDefaultCover = finalEventCoverImage.includes(
"fec-event-default-cover"
);
Expand Down Expand Up @@ -116,7 +114,7 @@ export default function EventCard({
<div className="flex items-center">
<IoLocation className="text-white mr-1" />
<span aria-label="活动地址" className="truncate">
{event.address}
{event.address || "尚未公布"}
</span>
</div>
</div>
Expand Down
12 changes: 7 additions & 5 deletions src/components/layout/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ export default function Footer({ isCNRegion }: { isCNRegion: boolean }) {
return (
<footer className="mt-8 bg-white rounded-t-xl p-6 text-sm text-center md:text-left">
<h5 className="block text-gray-600 mb-4 text-sm flex flex-col md:flex-row">
<span className="font-bold mr-2">毛茸茸展会目录</span>
<span className="font-bold mr-2">FEC·兽展日历</span>
<span className="">
FURRYEVENTCHINA.COM ©️{new Date().getFullYear()}
{isCNRegion ? "FURRYCONS.CN" : "FURRYEVENTCHINA.COM"} ©️
{new Date().getFullYear()}
</span>
</h5>

Expand Down Expand Up @@ -100,7 +101,7 @@ export function FriendSiteBlock() {
return (
<section className="bg-white p-6 rounded-xl mt-8 mx-1 lg:mx-0">
<h3 className="font-bold text-gray-600 text-2xl">友情链接</h3>
<div className="grid grid-cols-1 md:grid-cols-4 gap-4 mt-4">
<div className="grid grid-cols-1 md:grid-cols-3 gap-4 mt-4">
{FriendSiteLinks.map((link) => (
<Link
href={link.link}
Expand All @@ -113,11 +114,12 @@ export function FriendSiteBlock() {
},
})
}
className="bg-white p-6 rounded-xl flex items-center justify-center border group hover:border-red-300 transition duration-300 relative"
className="bg-white p-6 rounded-xl flex flex-col border group hover:border-red-300 hover:bg-red-300 transition duration-300 relative"
>
<h4 className="transition duration-300 text-center text-gray-600 group-hover:text-red-300 underline decoration-transparent group-hover:decoration-current decoration-wavy underline-offset-4">
<h4 className="text-xl font-bold mb-3 transition duration-300 text-gray-600 group-hover:text-white decoration-transparent group-hover:decoration-current decoration-wavy">
{link.label}
</h4>
<p className="group-hover:text-white transition duration-300 text-gray-600">{link.description}</p>
</Link>
))}
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/layout/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default function Header() {
<header className="mb-6 rounded-b-xl bg-white flex justify-between max-sm:sticky max-sm:top-0 max-sm:z-20 max-sm:shadow">
<div className="m-2 md:m-6 text-base md:text-4xl text-geraldine font-bold">
<span className="block">FEC 🐺🐱🐯</span>
<span className="text-base mt-0 block">毛茸茸展会目录</span>
<span className="text-base mt-0 block">FEC·兽展日历 / 新年快乐!🏮</span>
</div>
<div
className="block sm:hidden flex align-end justify-end mx-4 md:px-6 md:py-8 text-3xl text-red-400 items-center"
Expand Down
47 changes: 30 additions & 17 deletions src/constants/staticConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,49 @@ export const FriendSiteLinks = [
{
link: "https://www.wilddream.net/?utm_source=fec",
label: "WildDream创作站",
description:
"WildDream 创作站(野梦)是一个以原创作品分享为主的中文兽、兽人、动物、奇幻生物主题创作与交流站点,自 2015 年 8 月以来,为兽主题作品提供托管与展示服务。",
},
{
link: "https://www.kemono.games/?utm_source=fec",
label: "兽人控游戏库 Kemono.Games",
description:"地表最强兽人控游戏索引!从传统角色扮演兽游到恋爱模拟,或是战略类兽人游戏,甚至更小众的选择,你都能在这里找到。"
},
{
link: "https://novel.tigerkk.me/?utm_source=fec",
label: "兽人控小说站",
description:
"兽人控小说站是一个专为兽人控打造的聚合在线阅读平台。在这里,你可以找到和各种兽人相关的小说,随时享受阅读的乐趣,无需下载或安装任何软件。还可以自由切换翻译,选择你喜欢的阅读模式。",
},

{
link: "https://furcoder.org/?utm_source=fec",
label: "FurCoder.org",
description: "FurryEventChina.COM 是 FurCoder 组织下的托管项目。",
},
{
link: "https://m.nyanket.com/?utm_source=fec",
label: "Nyanket 喵通贩",
description:
"Nyanket 喵通贩 是最早立足于提供 票务一体化解决方案 的服务商,我们与兽展的故事起源于兽夏祭。",
},
];

export const AboutUsLinks = [
{
link: "https://github.com/FurCoder/furry-event-china",
label: "GitHub",
},
{
link: "https://status.furryeventchina.com",
label: "Status 监控",
},
{
link: "https://docs.furryeventchina.com",
label: "帮助文档",
},
{
link: "mailto:[email protected]",
label: "邮件联系我们",
},
];
{
link: "https://github.com/FurCoder/furry-event-china",
label: "GitHub",
},
{
link: "https://status.furryeventchina.com",
label: "Status 监控",
},
{
link: "https://docs.furryeventchina.com",
label: "帮助文档",
},
{
link: "mailto:[email protected]",
label: "邮件联系我们",
},
];
6 changes: 0 additions & 6 deletions src/pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ import { Html, Head, Main, NextScript } from "next/document";
import Script from "next/script";

const isEnableTrack = process.env.ENABLE_TRACK === "true";
console.log(
"ENABLE_TRACK",
process.env.ENABLE_TRACK,
typeof process.env.ENABLE_TRACK,
isEnableTrack
);

export default function Document() {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/pages/city.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default function City(props: { events: Event[] }) {
</ul>

<p className="text-gray-600 mt-4">
FurrrEventChina.com 共在 {cities.length} 个城市收录到 {events.length}{" "}
我们共在 {cities.length} 个城市收录到 {events.length}{" "}
个活动,其中,举办活动次数最多的城市是{" "}
<span className="font-bold">
{groupByCityEventsSortByTotalCount[0]}
Expand Down
1 change: 0 additions & 1 deletion src/pages/years.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export default function Years({ events }: { events: Event[] }) {
<div className="">
<div className="mb-4 border rounded-xl p-6 bg-white">
<p className="text-gray-600">
FurryEventChina.com{" "}
{years.filter((year) => year !== "no-date").length} 年共收录到{" "}
{events.length} 个活动,历年活动数据如下:
</p>
Expand Down
7 changes: 6 additions & 1 deletion src/utils/imageLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import { ImageLoaderProps } from "next/image";
import { EventRecord } from "@/xata/xata";

const GLOBAL_AUTO_CDN_IMAGE_URL = "images.furrycons.cn";
const GLOBAL_MANUAL_CDN_IMAGE_URL = "images.furryeventchina.com";

export const getEventCoverUrl = (event: Partial<EventRecord>) => {
return imageUrl(
event.coverUrl ||
event.posterUrl?.[0] ||
`https://images.furryeventchina.com/fec-event-default-cover.png`
`https://images.furrycons.cn/fec-event-default-cover.png`
);
};

Expand All @@ -18,6 +19,10 @@ export const imageUrl = (src: string) => {
.replace("https://images.furrycons.cn/", "")
.trim();

if (process.env.NODE_ENV === "development") {
return `https://${GLOBAL_MANUAL_CDN_IMAGE_URL}/${withoutDefaultHostSrc}`;
}

return `https://${GLOBAL_AUTO_CDN_IMAGE_URL}/${withoutDefaultHostSrc}`;
};

Expand Down
2 changes: 0 additions & 2 deletions src/utils/track.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@ export function sendTrack({
if (process.env.NODE_ENV !== "production") {
return console.info("Send Track", eventName, eventValue);
}
window.umami?.track(eventName, eventValue);
window.gtag && window.gtag("event", eventName, eventValue);
window.mixpanel?.track(eventName, eventValue);
}

declare global {
interface Window {
umami: { track: Function } | undefined;
gtag: Function | undefined;
mixpanel: { track: Function } | undefined;
TMap: any | undefined;
Expand Down

0 comments on commit f6fb3a7

Please sign in to comment.