Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: スポンサー一覧ページを作成する #170

Merged
merged 85 commits into from
Sep 29, 2019

Conversation

ryamakuchi
Copy link
Collaborator

@ryamakuchi ryamakuchi commented Sep 1, 2019

resolve: #132

TODO

  • master をマージする
  • Contentful からデータを取得する処理を Vuex に移動する
  • sponsors.vue と TheSponsorListSection.vue で Vuex Store を利用するように修正する
  • TheSponsorListSection.vue のテストの修正&追加をする
  • Vuex Store のテストを追加する
  • sponsors.vue のテストを追加する
  • セルフレビュー
  • 再レビュー依頼
  • Contentful の情報の修正
  • レビューの修正

レビューポイント

  • デザインを正確に表現できているか
  • ページのメタ情報は適当か
  • テストケースは十分か

この PR で対応しないこと

  • index のインタラクション

#132 (comment)
こちらのコメントのとおり、この PR では lg サイズ以上の index のインタラクションについては対応せず、別 PR で開発を進める予定です。

参考

close: #165

デザインカンプはこちら↓

https://www.figma.com/file/BpIgcZdusbS3CgPHQhhK79T7/Vue-Fes-Japan-2019-Web?node-id=1080%3A3423

@ryamakuchi ryamakuchi changed the title feat: スポンサー詳細ページを作成する [WIP] feat: スポンサー詳細ページを作成する Sep 1, 2019
@pr-triage pr-triage bot removed the PR: unreviewed label Sep 1, 2019
@ryamakuchi ryamakuchi self-assigned this Sep 1, 2019
@ryamakuchi
Copy link
Collaborator Author

ryamakuchi commented Sep 1, 2019

@inouetakuya @yotaszk @448jp

メタ情報のレビューをお願いします 🙏

メタ情報

    const url = `https://vuefes.jp/2019/sponsors`
    const title = 'スポンサー一覧 | Vue Fes Japan 2019'
    const description = 'Vue Fes Japan 2019 のスポンサー情報です。'

レビュー観点

  • スポンサー一覧ページ専用の OG 画像を用意する必要があるかどうか(現在はデフォルトの設定になっています)
    • ある場合は用意していただけると助かります!
  • 「スポンサー一覧」というタイトルは適切か

@448jp
Copy link
Contributor

448jp commented Sep 1, 2019

タイトル、私はいいと思います。専用OGPは不要(トップと同じでOK)です。

@inouetakuya inouetakuya added this to In progress in 本番サイト Phase 2 via automation Sep 2, 2019
src/pages/sponsors.vue Outdated Show resolved Hide resolved
@inouetakuya
Copy link
Contributor

sponsorPlansToHaveSponsor という名前は適切か?

  • ToHave だと「スポンサーを持つべき sponsorPlans」というニュアンスがある
  • 持っているスポンサーは複数なのに ToHaveSponsor である

という点に違和感を感じました。

「スポンサーを持っている sponsorPlan の一覧を取得できる」

これをそのまま表現して sponsorPlansHavingSponsors でどうでしょう?

なお、having の箇所は SQL の Having 句にインスパイアされています。

補足

デメリット

この手の後ろから修飾する言葉は、ループで回したりするときに、多少違和感が生まれます。

例)sponsorPlansHavingSponsors.forEach(sponsorPlan => ...)

(できれば xxxSponsorPlans で終わりたいという意味)

その他の案

「〇〇を持っている」として with を使うこともあります。

sponsorPlansWithSponsors とか。

ただし、この場合には、配列の要素ひとつひとつに sponsors が含まれている印象を持たせてしまうと思います。

[
  { sponsorPlan: { ... }, sponsors: [...] },
  { sponsorPlan: { ... }, sponsors: [...] },
  { sponsorPlan: { ... }, sponsors: [...] },...
]  

というものが帰って来そうな印象を受けます。今回のように「絞り込む」用途では having を使う方がよいと思います。

Copy link
Contributor

@inouetakuya inouetakuya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不安な部分

を書いてくださっていたのでレビューしやすかったです 👍

当該箇所にコメントしたので確認してください〜 ☺️

:key="sponsor.sys.id"
class="sponsor"
>
<a :href="sponsor.fields.url" target="_blank" rel="noopener">
<nuxt-link :to="`/sponsors/#sponsor_${sponsor.sys.id}`">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HTML の id 属性が数字から始まる場合、アンカーがうまく動作しないことがあったため sponsor_ プレフィックスを入れました。

あー、なるほど 👍

そすねー、自分もどうやって知ったんだっけなあ 🤔

結論

分かんない。途中まで調べたけど結局最後まで辿り着けませんでした。

後日、分かったら共有しますね〜

以下調べたログ

RFC3986

URI については RFC 3986 で定義されていますね。

RFC 3986 - Uniform Resource Identifier (URI): Generic Syntax
https://tools.ietf.org/html/rfc3986

RFC3986 で fragment あるいは fragment identifier と表記されているので、そちらの用語で調べた方がほしい情報に辿り着きやすそうです。

URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]

RFC2046

The fragment's format and resolution is therefore
dependent on the media type [RFC2046] of a potentially retrieved
representation, even though such a retrieval is only performed if the
URI is dereferenced.

という記述があり、つまり、fragment の format は RFC2046 に依存しているよ、と。

で、RFC2046 の中から、フラグメント識別子のフォーマットに関する記述を探してみたのですが、全然わからねえ...

src/store/sponsors.ts Show resolved Hide resolved
}
}
expect(
// Getters の型を備えたスタブを準備するのが大変でコストに見合わないため @ts-ignore
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ゲッターをモックするケース

第2引数として利用するゲッターが(Store から利用する場合に引数なしで)値を返す場合はモックしたほうがハンドリングしやすいと思います。

Vuex 公式ドキュメントにはその例が載っていますね。

その他の例

ゲッターをモックしないケース

一方で、今回のケースのように、第2引数として利用するゲッターが(Store から利用する場合に)引数を要する関数の場合は、モックしないほうが「第2引数のゲッターの内容を変更したときに自動的に追従してくれる」というメリットがあると思います。

getters.sponsorPlansToHaveSponsor(state, {
  sponsorsByPlan: getters.sponsorsByPlan(state)
})

src/types/sponsors.ts Outdated Show resolved Hide resolved
}
}

export interface SponsorPlans {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

あえてこのファイルの中に入れるのであれば

Suggested change
export interface SponsorPlans {
export interface SponsorPlan {

ですが(単数形にする)、この SponsorPlan は Contentful に独立したモデルとして登録しても良いくらいのものなので(アプリが既に完成しているので、今回は API 定義を変更しないほうがよいですが)、

types/sponsorPlan.ts に定義しても良いかなと思いました(自分だったらそうする)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

複数形と単数形がごっちゃになってしまいすみません💦
確かに定義を分けたほうが良いですね。

こちらも下記のコミットで対応しました!ありがとうございます。

1b9e897

})

test('plan と一致するスポンサー情報のみ取得できる', () => {
const platinumSponsor: SponsorPlans = sponsorList[2]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

配列についてテストしているので、下記のような感じでどうでしょう?

const platinumSponsors = [sponsorList[2]]

expect(getters.sponsorsByPlan(state)('platinum')).toEqual(
  platinumSponsors
)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ご指摘ありがとうございます! 🙇‍♀

496e1b0

こちらのコミットで修正しました。

@ryamakuchi ryamakuchi force-pushed the add-sponsor-details branch 2 times, most recently from f2bf02b to ee58d71 Compare September 28, 2019 16:04
Copy link
Contributor

@inouetakuya inouetakuya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

細かい点をコメントしましたが、lazyload だけマストで対応していただいて、後は want 扱いで OK です〜(あともうひと息だ!:relaxed:

])
})

test('スポンサープランの詳細が表示される', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

test('リンクがスポンサー一覧ページのアンカーになっている', () => {
const platinumSponsorSysId: string = sponsorList[2].sys.id
const platinumSponsorWrapper = wrapper.find('.platinum')
expect(platinumSponsorWrapper.find(RouterLinkStub).props().to).toBe(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

細かいですが、

Suggested change
expect(platinumSponsorWrapper.find(RouterLinkStub).props().to).toBe(
expect(wrapper.find('.platinum').find(RouterLinkStub).props().to).toBe(

というふうに繋げて書いても良いかも(お任せします)

@@ -2,12 +2,14 @@ import speakersData from '../../../fixtures/contentful/speakers'
import timeTableSectionsData from '../../../fixtures/contentful/timeTableSections'
import eventContainersData from '../../../fixtures/contentful/eventContainers'
import eventContainerPartsData from '../../../fixtures/contentful/eventContainerParts'
import sponsorsData from '../../../fixtures/contentful/sponsorList'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

他と合わせて下記で良さそうです。

Suggested change
import sponsorsData from '../../../fixtures/contentful/sponsorList'
import sponsorsData from '../../../fixtures/contentful/sponsors'

target="_blank"
rel="noopener noreferrer"
>
<img
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

このページは画像の数が多いので lazyload にしてもらいたいです〜 🙏

@inouetakuya
Copy link
Contributor

inouetakuya commented Sep 29, 2019

@ryamakuchi

あと「トップに戻る」との余白が小さすぎるようなので、ここだけマストで対応お願いします 🙏

(次の PR があるようなので lazyload はそちらに回してよいと思いました)

もう日にちが日にちなので、ここの対応だけ済ませて出しちゃいましょう〜!

image

@inouetakuya
Copy link
Contributor

rry さんから連絡があり、体調を崩してしまったとのことでしたので、代わりにコミットしました〜。マージします!

@inouetakuya inouetakuya merged commit cf20720 into master Sep 29, 2019
本番サイト Phase 2 automation moved this from In progress to Done Sep 29, 2019
@inouetakuya inouetakuya deleted the add-sponsor-details branch September 29, 2019 13:21
@ryamakuchi
Copy link
Collaborator Author

@inouetakuya おいちゃんさんすみません、風邪でダウンしていたところ作業していただいて大変申し訳ございませんでした!!! 🙇‍♀ 無事マージできたようで良かったです、ありがとうございます。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

スポンサーページ 設置 スポンサー一覧ページを作成する
7 participants