Skip to content

Commit

Permalink
Merge branch 'dev' into production
Browse files Browse the repository at this point in the history
  • Loading branch information
jaryapp committed Aug 20, 2023
2 parents 9554903 + e9fd477 commit 34e980f
Show file tree
Hide file tree
Showing 15 changed files with 121 additions and 30 deletions.
1 change: 1 addition & 0 deletions packages/mobile/src/components/atoms/icon/svg/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export { ReactComponent as man } from "./man.svg";
export { ReactComponent as map } from "./map.svg";
export { ReactComponent as notice } from "./notice.svg";
export { ReactComponent as subscribe } from "./subscribe.svg";
export { ReactComponent as unSubscribe } from "./unSubscribe.svg";
export { ReactComponent as thinDiet } from "./thin-diet.svg";
export { ReactComponent as unalarm } from "./unalarm.svg";
export { ReactComponent as version } from "./version.svg";
Expand Down
6 changes: 6 additions & 0 deletions packages/mobile/src/components/atoms/icon/svg/unSubscribe.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 21 additions & 5 deletions packages/mobile/src/components/molecules/DeepLink/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import {useState} from "react";
import { useState } from "react";
import { isIOS, isSafari } from "react-device-detect";

import {Close, LongArrow} from "@components/atoms/icon";
import { Close, LongArrow } from "@components/atoms/icon";
import classNames from "classnames";
import {isWebView} from "src/utils/webview";
import { isWebView } from "src/utils/webview";

import $ from "./style.module.scss";

Expand All @@ -13,8 +14,23 @@ function DeepLink() {

return (
<div className={classNames($.deeplink, { [$.isHidden]: isHidden })}>
<button type="button" className={$.left}>
충림이 앱으로 보기 <LongArrow size={6} stroke="#fff" />
<button
type="button"
className={$.left}
onClick={() => {
if (isIOS || isSafari) {
window.open(
"https://apps.apple.com/kr/app/%EC%B6%A9%EB%A6%BC%EC%9D%B4/id6447121993",
);

return;
}
window.open(
"https://play.google.com/store/apps/details?id=com.cbnu_alrami.app&hl=ko",
);
}}
>
충림이 앱 다운받기 <LongArrow size={6} stroke="#fff" />
</button>
<button
type="button"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
padding: 0 16px;
border-radius: 4px;
background: $black-80;
z-index: 100;

.left {
display: flex;
Expand All @@ -25,4 +26,4 @@

.isHidden {
visibility: hidden;
}
}
16 changes: 9 additions & 7 deletions packages/mobile/src/components/molecules/Drawer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import $ from "./style.module.scss";

type Props = {
id: number;
to: string;
to?: string;
isSubscribe: boolean;
isNotice: boolean;
isOpen: boolean;
Expand Down Expand Up @@ -101,12 +101,14 @@ function Drawer({ id, to, isSubscribe, isNotice, isOpen, setIsOpen }: Props) {
</div>
)}

<Link className={$.item} to={to}>
<div className={$.title}>
<Icon name="view" size={20} />
공지사항 보기
</div>
</Link>
{to && (
<Link className={$.item} to={to}>
<div className={$.title}>
<Icon name="view" size={20} />
공지사항 보기
</div>
</Link>
)}
</div>
</div>,
portalRootRef.current,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,48 @@ import { DefaultProps } from "src/type/props";
import $ from "./style.module.scss";

type Props = {
isPreview?: boolean;
isNotice: boolean;
isSubscribe: boolean;
} & DefaultProps;

function SubscriptionNoticeGroup({ isNotice, isSubscribe, className }: Props) {
function SubscriptionNoticeGroup({
isPreview = false,
isNotice,
isSubscribe,
className,
}: Props) {
if (isPreview) {
return (
<button
type="button"
className={classnames($["subscription-notice-group"], className)}
>
<div className={$.group}>
<Icon
name={isSubscribe ? "subscribe" : "unSubscribe"}
size={24}
color={isSubscribe ? "#828282" : "#D66D6E"}
/>

<Icon
name={isNotice ? "alarm" : "unalarm"}
size={24}
color={isNotice ? "#828282" : "#D66D6E"}
/>
</div>
</button>
);
}

return (
<button
type="button"
className={classnames($["subscription-notice-group"], className)}
>
{isSubscribe && (
<div className={$.group}>
<Icon name="subscribe" size={28} color="#D66D6E" />
<Icon name="subscribe" size={24} color="#D66D6E" />
{isNotice ? (
<Icon name="alarm" size={24} color="#D66D6E" />
) : (
Expand Down
5 changes: 5 additions & 0 deletions packages/mobile/src/page/Article/Detail/style.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
.content {
overflow-x: auto;
overflow-y: hidden;

img {
width: 100% !important;
height: auto !important;
}
}

.heart {
Expand Down
19 changes: 17 additions & 2 deletions packages/mobile/src/page/Board/Article/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { useState } from "react";
import { useLocation } from "react-router-dom";

import { LeftArrow } from "@components/atoms/icon";
import Drawer from "@components/molecules/Drawer";
import SubscriptionNoticeGroup from "@components/shared/SubscriptionNoticeGroup";
import FullPageModalTemplate from "@components/templates/FullPageModalTemplate";
import { useBoardQuery } from "@hooks/api/board";
Expand All @@ -11,6 +13,7 @@ import $ from "./style.module.scss";
function BoardArticle() {
const id = Number(useLocation().pathname.split("/").at(-1));
const { data: boardData } = useBoardQuery({ id });
const [ isOpen, setIsOpen ] = useState(false);

if (!boardData) return <></>;

Expand All @@ -26,16 +29,28 @@ function BoardArticle() {
</div>
}
right={
<div className={$.right}>
<button
type="button"
className={$.right}
onClick={() => {
return setIsOpen(true);
}}
>
<SubscriptionNoticeGroup
isPreview
isNotice={isNotice ?? false}
isSubscribe={isSubscribe ?? false}
/>
</div>
</button>
}
>
<ArticleList className={$["article-list-wrap"]} />
</FullPageModalTemplate>
<Drawer
{...{ id, isOpen, setIsOpen }}
isSubscribe={isSubscribe!}
isNotice={isNotice!}
/>
</div>
);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/mobile/src/page/Home/SuggestionModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type Props = {
const TEMPERATURE_LIST = [
{
minTemp: 28,
maxTemp: null,
maxTemp: 100,
displayTemp: "28°C~",
suggestionList: "민소매, 반팔, 반바지, 원피스",
},
Expand Down Expand Up @@ -52,7 +52,7 @@ const TEMPERATURE_LIST = [
suggestionList: "코트, 가죽자켓, 히트텍, 니트, 레깅스",
},
{
minTemp: null,
minTemp: -100,
maxTemp: 4,
displayTemp: "~4°C",
suggestionList: "패딩, 두꺼운코트, 목도리, 기모제품",
Expand Down
2 changes: 1 addition & 1 deletion packages/mobile/src/page/Setting/Main/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ type Props = {
const settingConfig = (cafeteria: string): Props => {
return {
대표식당: cafeteria,
"앱 버전": "최신버전(0.0.0)",
"앱 버전": "최신버전(1.0.0)",
};
};

Expand Down
10 changes: 10 additions & 0 deletions packages/mobile/src/page/Setting/Menu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ function Menu({ route, config }: Props) {
}
};

if (label === "앱 버전") {
return (
<div className={$["setting-menu"]}>
<Icon className={$.icon} name={route.icon} size={18} color="#5e5e5e" />
<span className={$.label}>{label}</span>
{config && <span className={$.config}>{config}</span>}
</div>
);
}

return (
<>
<NavLink
Expand Down
7 changes: 7 additions & 0 deletions packages/mobile/src/page/Setting/SettingTemplate/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useLocation, useNavigate } from "react-router-dom";

import classnames from "classnames";
import { LeftArrow } from "src/components/atoms/icon";
import { useAppSelector } from "src/store";
import { DefaultProps } from "src/type/props";

import FullPageModalTemplate from "../../../components/templates/FullPageModalTemplate";
Expand All @@ -15,8 +16,14 @@ type Props = {
function SettingTemplate({ className, title, children, right }: Props) {
const { pathname } = useLocation();
const navigate = useNavigate();
const origin = useAppSelector((state) => {
return state.boardReducer.origin;
});

const handleBackClick = () => {
if (origin === "subscribe") {
return navigate("/article/subscribe");
}
if (pathname === "/setting") {
return navigate("/home");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { boardTree } from "@shared/board-tree/board-tree.generated";

const script = {
url: "https://me.chungbuk.ac.kr/index.php?mid=me_sub04",
url: "https://me.chungbuk.ac.kr/me5_1",
site_id: boardTree.전공.공과대학.기계공학부.공지사항.id,
site: "기계공학부",
category: "공지사항",
noticeListSelector: "#bd_839_0 > div.bd_lst_wrp > table > tbody > tr",
noticeContentsSelector:
"#content > div.bd.hover_effect > div.rd.rd_nav_style2.clear > div.rd_body.clear > article",
noticeListSelector: "#bd_172_0 > div.bd_lst_wrp > table > tbody > tr",
noticeContentsSelector: "div.rd_body > article",
getNoticeList() {
const list = document.querySelectorAll(this.noticeListSelector);
return Array.from(list).map((item) => {
Expand All @@ -16,9 +15,9 @@ const script = {
site: this.site,
category: this.category,
site_id: this.site_id,
title: td[2].innerText.trim(),
url: td[2].querySelector("a").href.trim(),
date: td[4].innerText.trim(),
title: td[1].innerText.trim(),
url: td[1].querySelector("a").href.trim(),
date: td[3].innerText.trim(),
};
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { boardTree } from "@shared/board-tree/board-tree.generated";
import 취업지원본부공지사항 from "./취업지원본부공지사항";

const script = {
url: "https://hrd.cbnu.ac.kr/board/board_list.asp?groupno=1&listno=2",
url: "http://hrd.chungbuk.ac.kr/board/board_list.asp?groupno=1&listno=2",
site_id: boardTree.공통.취업지원본부.채용설명회.id,
site: "취업지원본부",
category: "채용설명회",
Expand Down
4 changes: 2 additions & 2 deletions packages/scraper/src/scraper/scraper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ export const scraping = async ({ scenario }: scrapingProps) => {
const stringScript = stringify(jsScript);
if (!stringScript) throw new Error("script 변환 오류");

// 모든 이미지 URL을 절대경로로 전환
await scraper.evaluate(
`document.querySelectorAll('img,iframe,frame').forEach(url=>url.src=url.src)`,
// 모든 이미지의 폭 사이즈를 100%로 통일 => 모바일뷰에서 잘보이도록
`document.querySelectorAll('img,iframe,frame').forEach(url=>url.src=url.src)`, // 모든 이미지 URL을 절대경로로 전환
);

await scraper.evaluate(`${namespace}=${stringScript}`);
Expand Down

0 comments on commit 34e980f

Please sign in to comment.