Skip to content

Commit

Permalink
Merge pull request #74 from naari3/delete-isss
Browse files Browse the repository at this point in the history
Delete implementation of isSs
  • Loading branch information
naari3 authored Mar 31, 2021
2 parents acd0d49 + dda4db7 commit 0241229
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 73 deletions.
36 changes: 0 additions & 36 deletions components/IsSsLink.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion components/Pager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const Pager: FC = () => {
const actualMaxPageNum = actualMaxPageNumber(
options.per,
options.count,
options.isSs ? MAX_SS_OFFSET : MAX_OFFSET
MAX_SS_OFFSET
);
setHasPrevPrevPage(options.page > 2);
setHasPrevPage(options.page > 1);
Expand Down
50 changes: 21 additions & 29 deletions components/SearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import styles from "./SearchBar.module.css";
import removeEmpty from "../lib/removeEmpty";
import parseLimitedFloat from "../lib/parseLimitedFloat";
import * as gtag from "../lib/gtag";
import IsSsLink from "./IsSsLink";

import {
useDispatch as useSearchDispatch,
Expand Down Expand Up @@ -109,12 +108,6 @@ const SearchBar: FC = () => {
{options.count.toLocaleString()} {t("results")}
</span>
)}
<span className={styles.ss}>
<IsSsLink
disableMessage={t("disable-ss")}
enableMessage={t("enable-ss")}
/>
</span>
{takesALongTime ? (
<div>
<span>{t("search-firsttime")}</span>
Expand Down Expand Up @@ -143,29 +136,28 @@ const SearchBar: FC = () => {
</option>
))}
</select>
{options.isSs ? (
{
""
) : (
<>
<span className={styles.filterName}>{t("user-id-filter")}</span>
<label>
<input
className={`${styles.inputNumber} ${styles.big}`}
type="number"
min="0"
value={options.userId || ""}
onChange={(e) => {
searchDispatch({
type: "update",
payload: {
userId: parseInt(e.target.value),
},
});
}}
/>
</label>
</>
)}
// <>
// <span className={styles.filterName}>{t("user-id-filter")}</span>
// <label>
// <input
// className={`${styles.inputNumber} ${styles.big}`}
// type="number"
// min="0"
// value={options.userId || ""}
// onChange={(e) => {
// searchDispatch({
// type: "update",
// payload: {
// userId: parseInt(e.target.value),
// },
// });
// }}
// />
// </label>
// </>
}
</div>
<div className={styles.filter}>
<span className={styles.filterName}>{t("my-list-count")}</span>
Expand Down
9 changes: 3 additions & 6 deletions pages_/search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,7 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
if (viewing !== "detail" && viewing !== "icon") viewing = "detail";
if (!per) per = 50;
const { query } = ctx;
const isSs = !!query.isSs;
const client = new (isSs ? VideoSnapshotClient : VideoClient)({
const client = new VideoSnapshotClient({
context: "otomad-search",
});
console.log(query);
Expand All @@ -279,7 +278,6 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
startTimeLte: roundDate(parseQueryToString(query.startTimeLte)),
page: roundNumber(parseQueryToInt(query.page)),
per: Math.min(100, roundNumber(parseQueryToInt(query.per)) || per),
isSs,
};
console.log({
cookie: per,
Expand All @@ -292,7 +290,7 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
> => {
if (shouldExecCall(searchOptions)) {
const searchQuery = getSearchQuery(searchOptions);
if (searchQuery._offset > (isSs ? MAX_SS_OFFSET : MAX_OFFSET)) {
if (searchQuery._offset > MAX_SS_OFFSET) {
searchQuery._offset = 0;
searchQuery._limit = 0;
}
Expand Down Expand Up @@ -327,7 +325,7 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
const actualMaxPageNum = actualMaxPageNumber(
searchOptions.per,
response.meta.totalCount,
isSs ? MAX_SS_OFFSET : MAX_OFFSET
MAX_SS_OFFSET
);

if (actualMaxPageNum < searchOptions.page) {
Expand All @@ -344,7 +342,6 @@ export const getServerSideProps: GetServerSideProps = async (ctx) => {
!!searchOptions.page || searchOptions.page < 0
? searchOptions.page
: 1,
isSs: searchOptions.isSs ? true : null,
},
viewing,
},
Expand Down
1 change: 0 additions & 1 deletion reducers/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export type SearchOptions = {
count?: number;
page?: number;
per?: number;
isSs?: boolean;
};

export const initialState: SearchOptions = { _sort: "-startTime" };
Expand Down

1 comment on commit 0241229

@vercel
Copy link

@vercel vercel bot commented on 0241229 Mar 31, 2021

Choose a reason for hiding this comment

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

Please sign in to comment.