Skip to content

Commit

Permalink
コンフリクトを解消
Browse files Browse the repository at this point in the history
  • Loading branch information
fuwa-syugyo committed Nov 3, 2023
2 parents 2e132b0 + 671042a commit c3a56a6
Show file tree
Hide file tree
Showing 45 changed files with 828 additions and 579 deletions.
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ version: 2.1
orbs:
ruby: circleci/[email protected]
node: circleci/[email protected]
browser-tools: circleci/[email protected].3
browser-tools: circleci/[email protected].6
jobs:
build:
docker:
- image: cimg/ruby:3.1.0-node
- image: cimg/ruby:3.1.4-node
steps:
- checkout
- ruby/install-deps
Expand All @@ -18,7 +18,7 @@ jobs:
pkg-manager: yarn
check:
docker:
- image: 'cimg/ruby:3.1.0-node'
- image: 'cimg/ruby:3.1.4-node'
steps:
- checkout
- ruby/install-deps
Expand All @@ -41,7 +41,7 @@ jobs:
command: bin/yarn lint
test:
docker:
- image: cimg/ruby:3.1.0-browsers
- image: cimg/ruby:3.1.4-browsers
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.0
3.1.4
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ruby:3.1.0-alpine
FROM ruby:3.1.4-alpine

ENV RAILS_ENV production
WORKDIR /app
Expand All @@ -21,7 +21,7 @@ RUN apk add --no-cache \
cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime

# ImageMagick
RUN apk add --no-cache imagemagick bash pngcrush optipng=0.7.7-r0 ghostscript-fonts
RUN apk add --no-cache imagemagick bash pngcrush optipng=0.7.7-r1 ghostscript-fonts

# Install npm packages
COPY package.json yarn.lock ./
Expand Down
5 changes: 2 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '3.1.0'
ruby '3.1.4'

gem 'bootsnap', '>= 1.4.4', require: false
gem 'image_processing', '~> 1.12'
Expand All @@ -29,7 +29,7 @@ gem 'country_select'
gem 'data_migrate'
gem 'diffy'
gem 'discord-notifier'
gem 'discordrb', github: 'shardlab/discordrb', require: false
gem 'discordrb', '~> 3.5', require: false
gem 'good_job', '~> 3.14', github: 'komagata/good_job'
gem 'google-cloud-storage', '~> 1.25', require: false
gem 'holiday_jp'
Expand Down Expand Up @@ -104,6 +104,5 @@ group :test do
gem 'minitest-retry'
gem 'selenium-webdriver'
gem 'vcr'
gem 'webdrivers'
gem 'webmock'
end
62 changes: 26 additions & 36 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,6 @@ GIT
i18n (>= 0.6, < 2.0)
railties (>= 4.0)

GIT
remote: https://github.com/shardlab/discordrb.git
revision: ad5dd1641f3653ca4e76d44f901adb42018e354e
specs:
discordrb (3.4.2)
discordrb-webhooks (~> 3.4.2)
ffi (>= 1.9.24)
opus-ruby
rest-client (>= 2.0.0)
websocket-client-simple (>= 0.3.0)
discordrb-webhooks (3.4.2)
rest-client (>= 2.0.0)

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -110,7 +97,7 @@ GEM
activerecord (>= 6.0, < 7.1)
acts_as_list (1.0.4)
activerecord (>= 4.2)
addressable (2.8.4)
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
any_login (1.5.2)
rails (>= 6.0)
Expand All @@ -133,7 +120,7 @@ GEM
thor (>= 0.20)
tty-table (~> 0.10)
byebug (11.1.3)
capybara (3.39.1)
capybara (3.39.2)
addressable
matrix
mini_mime (>= 0.1.3)
Expand Down Expand Up @@ -162,6 +149,14 @@ GEM
digest-crc (0.6.4)
rake (>= 12.0.0, < 14.0.0)
discord-notifier (1.0.3)
discordrb (3.5.0)
discordrb-webhooks (~> 3.5.0)
ffi (>= 1.9.24)
opus-ruby
rest-client (>= 2.0.0)
websocket-client-simple (>= 0.3.0)
discordrb-webhooks (3.5.0)
rest-client (>= 2.0.0)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
erubi (1.11.0)
Expand Down Expand Up @@ -278,12 +273,12 @@ GEM
meta-tags (2.18.0)
actionpack (>= 3.2.0, < 7.1)
method_source (1.0.0)
mime-types (3.4.1)
mime-types (3.5.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2022.0105)
mime-types-data (3.2023.1003)
mini_magick (4.11.0)
mini_mime (1.1.2)
mini_portile2 (2.8.2)
mini_mime (1.1.5)
mini_portile2 (2.8.4)
minitest (5.17.0)
minitest-ci (3.4.0)
minitest (>= 5.0.6)
Expand All @@ -304,10 +299,10 @@ GEM
netrc (0.11.0)
newspaper (0.2.0)
nio4r (2.5.9)
nokogiri (1.15.1)
nokogiri (1.15.4)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
nokogiri (1.15.1-x86_64-darwin)
nokogiri (1.15.4-x86_64-darwin)
racc (~> 1.4)
oauth (0.6.2)
snaky_hash (~> 2.0)
Expand Down Expand Up @@ -354,12 +349,12 @@ GEM
pry (>= 0.13, < 0.15)
psych (4.0.6)
stringio
public_suffix (5.0.1)
public_suffix (5.0.3)
puma (6.3.1)
nio4r (~> 2.0)
raabro (1.4.0)
racc (1.6.2)
rack (2.2.7)
racc (1.7.1)
rack (2.2.8)
rack-cors (1.1.1)
rack (>= 2.0.0)
rack-dev-mark (0.7.9)
Expand Down Expand Up @@ -423,7 +418,7 @@ GEM
tilt
recaptcha (5.12.3)
json
regexp_parser (2.8.0)
regexp_parser (2.8.2)
representable (3.2.0)
declarative (< 0.1.0)
trailblazer-option (>= 0.1.1, < 0.2.0)
Expand All @@ -434,7 +429,7 @@ GEM
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
retriable (3.1.2)
rexml (3.2.5)
rexml (3.2.6)
rollbar (3.3.2)
rss (0.2.9)
rexml
Expand Down Expand Up @@ -470,7 +465,7 @@ GEM
ffi (~> 1.12)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
selenium-webdriver (4.9.1)
selenium-webdriver (4.14.0)
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
Expand Down Expand Up @@ -551,10 +546,6 @@ GEM
activemodel (>= 6.0.0)
bindex (>= 0.4.0)
railties (>= 6.0.0)
webdrivers (5.2.0)
nokogiri (~> 1.6)
rubyzip (>= 1.3.0)
selenium-webdriver (~> 4.0)
webmock (3.18.1)
addressable (>= 2.8.0)
crack (>= 0.3.2)
Expand All @@ -565,8 +556,8 @@ GEM
railties (>= 5.2)
semantic_range (>= 2.3.0)
webrick (1.7.0)
websocket (1.2.9)
websocket-client-simple (0.6.0)
websocket (1.2.10)
websocket-client-simple (0.8.0)
event_emitter
websocket
websocket-driver (0.7.5)
Expand Down Expand Up @@ -603,7 +594,7 @@ DEPENDENCIES
data_migrate
diffy
discord-notifier
discordrb!
discordrb (~> 3.5)
foreman
good_job (~> 3.14)!
google-cloud-storage (~> 1.25)
Expand Down Expand Up @@ -666,12 +657,11 @@ DEPENDENCIES
vcr
view_source_map
web-console (>= 4.1.0)
webdrivers
webmock
webpacker (~> 5.0)

RUBY VERSION
ruby 3.1.0p0
ruby 3.1.4p223

BUNDLED WITH
2.3.6
6 changes: 6 additions & 0 deletions app/controllers/pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ def create
Newspaper.publish(:page_create, @page)
url = new_announcement_url(page_id: @page.id) if @page.announcement_of_publication?
end

current_user.become_watcher!(@page)

redirect_to url, notice: notice_message(@page, :create)
else
render :new
Expand All @@ -60,6 +63,9 @@ def update
Newspaper.publish(:page_update, @page)
url = new_announcement_path(page_id: @page.id) if @page.announcement_of_publication?
end

current_user.become_watcher!(@page)

redirect_to url, notice: notice_message(@page, :update)
else
render :edit
Expand Down
23 changes: 5 additions & 18 deletions app/javascript/components/AdminCompanies.jsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
import React, { useState, useEffect } from 'react'
import queryString from 'query-string'
import React from 'react'
import useSWR from 'swr'
import fetcher from '../fetcher'
import Pagination from './Pagination'
import usePage from './hooks/usePage'

export default function AdminCompanies() {
const per = 20
const neighbours = 4
const defaultPage = parseInt(queryString.parse(location.search).page) || 1
const [page, setPage] = useState(defaultPage)

useEffect(() => {
setPage(page)
}, [page])
const { page, setPage } = usePage()

const { data, error } = useSWR(
`/api/admin/companies.json?page=${page}&per=${per}`,
Expand All @@ -21,20 +15,14 @@ export default function AdminCompanies() {
if (error) return <>An error has occurred.</>
if (!data) return <>Loading...</>

const handlePaginate = (p) => {
setPage(p)
window.history.pushState(null, null, `/admin/companies?page=${p}`)
}

return (
<div data-testid="admin-companies">
{data.total_pages > 1 && (
<Pagination
sum={data.total_pages * per}
per={per}
neighbours={neighbours}
page={page}
onChange={(e) => handlePaginate(e.page)}
setPage={setPage}
/>
)}
<div className="admin-table">
Expand All @@ -60,9 +48,8 @@ export default function AdminCompanies() {
<Pagination
sum={data.total_pages * per}
per={per}
neighbours={neighbours}
page={page}
onChange={(e) => handlePaginate(e.page)}
setPage={setPage}
/>
)}
</div>
Expand Down
23 changes: 5 additions & 18 deletions app/javascript/components/Bookmarks.jsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,21 @@
import React, { useState, useEffect } from 'react'
import queryString from 'query-string'
import React, { useState } from 'react'
import useSWR, { useSWRConfig } from 'swr'
import fetcher from '../fetcher'
import Bootcamp from '../bootcamp'
import UserIcon from './UserIcon'
import Pagination from './Pagination'
import usePage from './hooks/usePage'

export default function Bookmarks() {
const [editable, setEditable] = useState(false)
const per = 20
const neighbours = 4
const defaultPage = parseInt(queryString.parse(location.search).page) || 1
const [page, setPage] = useState(defaultPage)
const { page, setPage } = usePage()
const bookmarksUrl = `/api/bookmarks.json?page=${page}&per=${per}`

useEffect(() => {
setPage(page)
}, [page])

const { data, error } = useSWR(bookmarksUrl, fetcher)
if (error) return <>エラーが発生しました。</>
if (!data) return <>ロード中…</>

const handlePaginate = (p) => {
setPage(p)
window.history.pushState(null, null, `/current_user/bookmarks?page=${p}`)
}

if (data.totalPages === 0) {
return <NoBookmarks />
} else {
Expand Down Expand Up @@ -64,9 +53,8 @@ export default function Bookmarks() {
<Pagination
sum={data.totalPages * per}
per={per}
neighbours={neighbours}
page={page}
onChange={(e) => handlePaginate(e.page)}
setPage={setPage}
/>
)}
<div className="card-list a-card">
Expand All @@ -88,9 +76,8 @@ export default function Bookmarks() {
<Pagination
sum={data.totalPages * per}
per={per}
neighbours={neighbours}
page={page}
onChange={(e) => handlePaginate(e.page)}
setPage={setPage}
/>
)}
</div>
Expand Down
3 changes: 2 additions & 1 deletion app/javascript/components/Categories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ const Category = ({ category }) => {
return (
<tr className="admin-table__item">
<td className="admin-table__item-value">
<a href={`/mentor/categories/${category.id}`}>{category.name}</a>
<a href={`/mentor/categories/${category.id}`}>{category.name}</a>(
{category.practices.length})
</td>
<td className="admin-table__item-value">{category.slug}</td>
<td className="admin-table__item-value is-text-align-center">
Expand Down
Loading

0 comments on commit c3a56a6

Please sign in to comment.