This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from "react"; | |
import { RefObject } from "react"; | |
import { IContainerComponentProps } from "../../model/ui/IContainerComponentProps"; | |
import { Backoff } from "../../services/util/Backoff"; | |
import { DynamicIntervalHandler } from "../../services/util/VariableIntervaller"; | |
const classnames = require("classnames"); | |
const styles = require("./style.scss"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Linear backoff strategy | |
*/ | |
export class Backoff { | |
private timeMillisToSleep: number; | |
private start: number; | |
private max: number; | |
private step: number; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export interface IContainerComponentProps { | |
className?: string; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class Explore extends React.Component<Props, State> { | |
public render() { | |
const req: PageableSearchResult<string> | undefined = this.getRequest(); | |
return ( | |
<Pagination<number> | |
ref={this.paginationRef} | |
lastSyncedPage={this.lastSyncedPage()} | |
requestPage={(page: number) => this.requestPage(page)} | |
nextPage={() => req != null && req.next != null ? req.next : undefined} | |
> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class VariableIntervaller { | |
private id: number = 0; | |
private dic: any = {}; | |
public start(work: () => void, getTimeout: () => number): number { | |
const newID: number = this.id++; | |
this.dic[newID] = { | |
run: true, | |
intervaller: undefined |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Setting readonly to force immutability | |
interface Person { | |
readonly id: string; | |
readonly name: string; | |
// Using https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL | |
// to store image blob as temp urls | |
// Just remeber to call revokeObjectURL() when you are done with this | |
readonly avatarURL?: string; | |
readonly bannerURL?: string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
renderUsers(): any { | |
return ( | |
<div className="result"> | |
{ | |
this.props.result.map((user: User) => { | |
return ( | |
<Card | |
key={user.id} | |
title={user.name} | |
avatar={user.avatarURL} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type CacheGroup = "USER_BANNER" | "USER_AVATAR"; | |
export interface CacheKey { | |
readonly group: CacheGroup; | |
readonly id: string; | |
} | |
export function idFromCacheKey(key: CacheKey) { | |
return key.group + "@_@" + key.group; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export enum CacheActionType { | |
CACHE_CLEANUP = "CACHE_CLEANUP", | |
CACHE_PURGE_ITEM = "CACHE_PRUGE_ITEM" | |
} | |
export function cleanupCache(): Action<CacheActionType> { | |
return { | |
type: CacheActionType.CACHE_CLEANUP | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plugins { | |
id 'org.springframework.boot' version '2.1.6.RELEASE' | |
id 'java' | |
id 'jacoco' | |
id 'checkstyle' | |
} | |
apply plugin: 'io.spring.dependency-management' | |
group = 'com.codecamos' |
OlderNewer