Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/tokanada/info-pride
Browse files Browse the repository at this point in the history
  • Loading branch information
tokanada committed Oct 7, 2022
2 parents 983050b + 65823ce commit c4f4911
Show file tree
Hide file tree
Showing 51 changed files with 768 additions and 469 deletions.
9 changes: 9 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@
"contributions": [
"data"
]
},
{
"login": "tokanada",
"name": "David T",
"avatar_url": "https://avatars.githubusercontent.com/u/9441423?v=4",
"profile": "https://github.com/tokanada",
"contributions": [
"translation"
]
}
],
"contributorsPerLine": 7,
Expand Down
190 changes: 96 additions & 94 deletions .github/workflows/bundle-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,109 +1,111 @@
name: 'Next.js Bundle Analysis'
name: "Next.js Bundle Analysis"

on:
pull_request:
push:
branches:
- master
workflow_dispatch:
pull_request:
push:
branches:
- master
workflow_dispatch:

jobs:
analyze:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
analyze:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- uses: actions/checkout@v2

- name: Set up node
uses: actions/setup-node@v1
with:
node-version: '16.x'
- name: Set up node
uses: actions/setup-node@v1
with:
node-version: "16.x"

- name: Install dependencies
run: npx pnpm install
- name: Install dependencies
run: npx pnpm install

- name: Restore next build
uses: actions/cache@v2
id: restore-build-cache
env:
cache-name: cache-next-build
with:
# if you use a custom build directory, replace all instances of `.next` in this file with your build directory
# ex: if your app builds to `dist`, replace `.next` with `dist`
path: .next/cache
# change this if you prefer a more strict cache
key: ${{ runner.os }}-build-${{ env.cache-name }}
- name: Restore next build
uses: actions/cache@v2
id: restore-build-cache
env:
cache-name: cache-next-build
with:
# if you use a custom build directory, replace all instances of `.next` in this file with your build directory
# ex: if your app builds to `dist`, replace `.next` with `dist`
path: .next/cache
# change this if you prefer a more strict cache
key: ${{ runner.os }}-build-${{ env.cache-name }}

- name: Build next.js app
env:
DISABLE_SENTRY: yes
# change this if your site requires a custom build command
run: ./node_modules/.bin/next build
- name: Build next.js app
env:
DISABLE_SENTRY: yes
# change this if your site requires a custom build command
run: ./node_modules/.bin/next build

# Here's the first place where next-bundle-analysis' own script is used
# This step pulls the raw bundle stats for the current bundle
- name: Analyze bundle
run: npx -p nextjs-bundle-analysis report
# Here's the first place where next-bundle-analysis' own script is used
# This step pulls the raw bundle stats for the current bundle
- name: Analyze bundle
run: npx -p nextjs-bundle-analysis report

- name: Upload bundle
uses: actions/upload-artifact@v2
with:
name: bundle
path: .next/analyze/__bundle_analysis.json
- name: Upload bundle
uses: actions/upload-artifact@v2
with:
name: bundle
path: .next/analyze/__bundle_analysis.json

- name: Download base branch bundle stats
uses: dawidd6/action-download-artifact@v2
if: success() && github.event.number
with:
workflow: bundle-analysis.yml
branch: ${{ github.event.pull_request.base.ref }}
path: .next/analyze/base
- name: Download base branch bundle stats
uses: dawidd6/action-download-artifact@v2
if: success() && github.event.number
with:
workflow: bundle-analysis.yml
branch: ${{ github.event.pull_request.base.ref }}
path: .next/analyze/base

# And here's the second place - this runs after we have both the current and
# base branch bundle stats, and will compare them to determine what changed.
# There are two configurable arguments that come from package.json:
#
# - budget: optional, set a budget (bytes) against which size changes are measured
# it's set to 350kb here by default, as informed by the following piece:
# https://infrequently.org/2021/03/the-performance-inequality-gap/
#
# - red-status-percentage: sets the percent size increase where you get a red
# status indicator, defaults to 20%
#
# Either of these arguments can be changed or removed by editing the `nextBundleAnalysis`
# entry in your package.json file.
- name: Compare with base branch bundle
if: success() && github.event.number
run: ls -laR .next/analyze/base && npx -p nextjs-bundle-analysis compare
# And here's the second place - this runs after we have both the current and
# base branch bundle stats, and will compare them to determine what changed.
# There are two configurable arguments that come from package.json:
#
# - budget: optional, set a budget (bytes) against which size changes are measured
# it's set to 350kb here by default, as informed by the following piece:
# https://infrequently.org/2021/03/the-performance-inequality-gap/
#
# - red-status-percentage: sets the percent size increase where you get a red
# status indicator, defaults to 20%
#
# Either of these arguments can be changed or removed by editing the `nextBundleAnalysis`
# entry in your package.json file.
- name: Compare with base branch bundle
if: success() && github.event.number
run: ls -laR .next/analyze/base && npx -p nextjs-bundle-analysis compare

- name: Get comment body
id: get-comment-body
if: success() && github.event.number
run: |
body=$(cat .next/analyze/__bundle_analysis_comment.txt)
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo ::set-output name=body::$body
- name: Find Comment
uses: peter-evans/find-comment@v1
if: success() && github.event.number
id: fc
with:
issue-number: ${{ github.event.number }}
body-includes: '<!-- __NEXTJS_BUNDLE -->'
- name: Get comment body
id: get-comment-body
if: success() && github.event.number
run: |
body=$(cat .next/analyze/__bundle_analysis_comment.txt)
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo ::set-output name=body::$body
- name: Find Comment
uses: peter-evans/find-comment@v1
if: success() && github.event.number
id: fc
with:
issue-number: ${{ github.event.number }}
body-includes: "<!-- __NEXTJS_BUNDLE -->"

- name: Create Comment
uses: peter-evans/[email protected]
if: success() && github.event.number && steps.fc.outputs.comment-id == 0
with:
issue-number: ${{ github.event.number }}
body: ${{ steps.get-comment-body.outputs.body }}
- name: Create Comment
uses: peter-evans/[email protected]
if: success() && github.event.number && steps.fc.outputs.comment-id == 0
with:
issue-number: ${{ github.event.number }}
body: ${{ steps.get-comment-body.outputs.body }}

- name: Update Comment
uses: peter-evans/[email protected]
if: success() && github.event.number && steps.fc.outputs.comment-id != 0
with:
issue-number: ${{ github.event.number }}
body: ${{ steps.get-comment-body.outputs.body }}
comment-id: ${{ steps.fc.outputs.comment-id }}
edit-mode: replace
- name: Update Comment
uses: peter-evans/[email protected]
if: success() && github.event.number && steps.fc.outputs.comment-id != 0
with:
issue-number: ${{ github.event.number }}
body: ${{ steps.get-comment-body.outputs.body }}
comment-id: ${{ steps.fc.outputs.comment-id }}
edit-mode: replace
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ INFO PRIDE (Beta)
![Build Status](https://badgen.net/github/status/outloudvi/info-pride?icon=vercel)

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->

[![All Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg)](#contributors-)

[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

## Planned features & Bug-fixes
Expand Down Expand Up @@ -45,10 +43,16 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tr>
<td align="center"><a href="https://blog.outv.im"><img src="https://avatars.githubusercontent.com/u/19144373?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Outvi V</b></sub></a><br /><a href="https://github.com/outloudvi/info-pride/commits?author=outloudvi" title="Code">💻</a></td>
<td align="center"><a href="https://malitsplus.blogspot.com"><img src="https://avatars.githubusercontent.com/u/50281195?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Vibbit</b></sub></a><br /><a href="#data-MalitsPlus" title="Data">🔣</a></td>
</tr>
<tbody>
<tr>
<td align="center"><a href="https://blog.outv.im"><img src="https://avatars.githubusercontent.com/u/19144373?v=4?s=100" width="100px;" alt="Outvi V"/><br /><sub><b>Outvi V</b></sub></a><br /><a href="https://github.com/outloudvi/info-pride/commits?author=outloudvi" title="Code">💻</a></td>
<td align="center"><a href="https://malitsplus.blogspot.com"><img src="https://avatars.githubusercontent.com/u/50281195?v=4?s=100" width="100px;" alt="Vibbit"/><br /><sub><b>Vibbit</b></sub></a><br /><a href="#data-MalitsPlus" title="Data">🔣</a></td>
<td align="center"><a href="https://github.com/tokanada"><img src="https://avatars.githubusercontent.com/u/9441423?v=4?s=100" width="100px;" alt="David T"/><br /><sub><b>David T</b></sub></a><br /><a href="#translation-tokanada" title="Translation">🌍</a></td>
</tr>
</tbody>
<tfoot>

</tfoot>
</table>

<!-- markdownlint-restore -->
Expand Down
12 changes: 6 additions & 6 deletions components/characters/CharacterItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import { APIResponseOf, UnArray } from '#utils/api'
import { CharacterId, PrimaryCharacterIds } from '#data/vendor/characterId'
import Paths from '#utils/paths'
import { IdolyFashionUrl, IdolyRoomUrl } from '#data/ipcmmu.data'
import { Idols } from '#data/wikiPages'
import BirthdayCommu from '#components/characters/BirthdayCommu'
import { toHashColor } from '#utils/toHashColor'
import useFrontendApi from '#utils/useFrontendApi'

const BirthdayCommuException: CharacterId[] = ['char-mna']
const VoiceException: CharacterId[] = ['char-mku']
Expand All @@ -39,6 +39,10 @@ const CharacterItem = ({
const { id, characterGroupId, name, enName, color } = character

const { data: CharacterData, isSuccess } = useApi('Character', { ids: id })
const { data: ProfileData } = useFrontendApi('characters/profile', {
id,
locale,
})

if (!isSuccess) {
return <Skeleton height={700} />
Expand Down Expand Up @@ -130,11 +134,7 @@ const CharacterItem = ({
></span>
</Blockquote>
)}
{Idols[id] ? (
<p>{Idols[id].desc}</p>
) : profile ? (
<p>{profile}</p>
) : null}
<p>{ProfileData?.profile ?? profile}</p>
<Grid>
<Grid.Col xs={12} lg={8}>
{CharacterData && (
Expand Down
4 changes: 1 addition & 3 deletions components/eventstories/EventStoryView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,7 @@ const EventStoryEpisodeList = ({
{StoryData ? (
<EventEpisodeDetail id={selectedStoryId} story={StoryData} />
) : (
<div className="text-gray-500 text-center">
{$c('Loading...')}
</div>
<div className="text-gray-500 text-center">{$c('loading')}</div>
)}
</>
)
Expand Down
2 changes: 1 addition & 1 deletion components/indexPage/SiteNotice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const SiteNotice = () => {
))}
</ul>
) : (
<p className="text-gray-500">{$c('Loading...')}</p>
<p className="text-gray-500">{$c('loading')}</p>
)
}

Expand Down
2 changes: 1 addition & 1 deletion components/layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const Layout = ({ children }: { children: ReactNode }) => {
return () => {
router.events.off('routeChangeComplete', maybeCollapseNavbar)
}
})
}, [router.events, setExpandedNavbar])

return (
<>
Expand Down
2 changes: 1 addition & 1 deletion components/messages/ChatList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const ChatList = ({
))}
</Stack>
) : (
<div className="text-white text-center">{$c('Loading...')}</div>
<div className="text-white text-center">{$c('loading')}</div>
)}
</div>
)
Expand Down
2 changes: 1 addition & 1 deletion components/messages/ChatView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const ChatView = ({
if (!msg) {
return (
<div className="flex h-full justify-center items-center flex-col">
<div className="text-white">{$c('Loading...')}</div>
<div className="text-white">{$c('loading')}</div>
<Button
className="mt-2"
onClick={() => {
Expand Down
53 changes: 53 additions & 0 deletions components/stories/SeasonChapterList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { useTranslations } from 'next-intl'
import _range from 'lodash/range'
import { Button } from '@mantine/core'

import { SeriesName } from '#data/stories'

const SeasonChapterList = ({
series,
season,
length,
selected,
completion,
onClick,
}: {
series: SeriesName
season: number
length: number
selected: number | null
completion: Record<number, 0 | 1>
onClick: (c: number) => void
}) => {
const $t = useTranslations('stories')

return (
<div>
<p>
{$t(`series.${series}`)}{' '}
{$t('season', {
s: season,
})}
</p>
{_range(1, length + 1).map((chapter) => {
const currentSelection = chapter === selected
return (
<Button
variant="subtle"
compact
color={completion[chapter - 1] ? 'blue' : 'teal'}
key={chapter}
onClick={() => {
onClick(chapter)
}}
disabled={currentSelection}
>
{season}-{chapter}
</Button>
)
})}
</div>
)
}

export default SeasonChapterList
Loading

0 comments on commit c4f4911

Please sign in to comment.