index int64 0 0 | repo_id stringlengths 16 181 | file_path stringlengths 28 270 | content stringlengths 1 11.6M | __index_level_0__ int64 0 10k |
|---|---|---|---|---|
0 | petrpan-code/WalletConnect/web3modal/packages/wagmi | petrpan-code/WalletConnect/web3modal/packages/wagmi/src/client.ts | import type { Address, Chain, Config, WindowProvider } from '@wagmi/core'
import {
connect,
disconnect,
fetchBalance,
fetchEnsAvatar,
fetchEnsName,
getAccount,
getNetwork,
switchNetwork,
watchAccount,
watchNetwork
} from '@wagmi/core'
import { mainnet } from '@wagmi/core/chains'
import type {
Caip... | 1,600 |
0 | petrpan-code/WalletConnect/web3modal/packages/wagmi/src | petrpan-code/WalletConnect/web3modal/packages/wagmi/src/connectors/EIP6963Connector.ts | import type { Chain, WindowProvider } from '@wagmi/core'
import { InjectedConnector } from '@wagmi/core/connectors/injected'
// -- Helpers ----------------------------------------------------------
const connectedRdnsKey = 'connectedRdns'
// -- Types ------------------------------------------------------------
interf... | 1,601 |
0 | petrpan-code/WalletConnect/web3modal/packages/wagmi/src | petrpan-code/WalletConnect/web3modal/packages/wagmi/src/utils/constants.ts | export const WALLET_CHOICE_KEY = 'wagmi.wallet'
| 1,602 |
0 | petrpan-code/WalletConnect/web3modal/packages/wagmi/src | petrpan-code/WalletConnect/web3modal/packages/wagmi/src/utils/defaultWagmiCoreConfig.ts | import '@web3modal/polyfills'
import type { Chain } from '@wagmi/core'
import { configureChains, createConfig } from '@wagmi/core'
import { CoinbaseWalletConnector } from '@wagmi/core/connectors/coinbaseWallet'
import { InjectedConnector } from '@wagmi/core/connectors/injected'
import { WalletConnectConnector } from '... | 1,603 |
0 | petrpan-code/WalletConnect/web3modal/packages/wagmi/src | petrpan-code/WalletConnect/web3modal/packages/wagmi/src/utils/defaultWagmiReactConfig.ts | import '@web3modal/polyfills'
import { configureChains, createConfig } from 'wagmi'
import { CoinbaseWalletConnector } from 'wagmi/connectors/coinbaseWallet'
import { InjectedConnector } from 'wagmi/connectors/injected'
import { WalletConnectConnector } from 'wagmi/connectors/walletConnect'
import { publicProvider } f... | 1,604 |
0 | petrpan-code/WalletConnect/web3modal/packages/wagmi/src | petrpan-code/WalletConnect/web3modal/packages/wagmi/src/utils/helpers.ts | import type { CaipNetwork } from '@web3modal/scaffold'
import type { Chain } from '@wagmi/core'
import { ConstantsUtil, PresetsUtil } from '@web3modal/scaffold-utils'
export function getCaipDefaultChain(chain?: Chain) {
if (!chain) {
return undefined
}
return {
id: `${ConstantsUtil.EIP155}:${chain.id}`,... | 1,605 |
0 | petrpan-code/WalletConnect/web3modal/packages/wagmi/src | petrpan-code/WalletConnect/web3modal/packages/wagmi/src/utils/provider.ts | import type { Chain, ChainProviderFn } from '@wagmi/core'
import { CoreHelperUtil } from '@web3modal/scaffold'
import { ConstantsUtil } from '@web3modal/scaffold-utils'
// -- Helpers ------------------------------------------------------------------
const RPC_URL = CoreHelperUtil.getBlockchainApiUrl()
// -- Types ---... | 1,606 |
0 | petrpan-code/clintonwoo | petrpan-code/clintonwoo/hackernews-react-graphql/.dockerignore | .git
.next
build
dist
docs
node_modules
npm-debug.log
| 1,607 |
0 | petrpan-code/clintonwoo | petrpan-code/clintonwoo/hackernews-react-graphql/.eslintrc.js | module.exports = {
env: {
browser: true,
es6: true,
node: true,
},
ignorePatterns: ['node_modules', '**/__mocks__*', '**/__tests__*', '**/*.spec.*'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
sourceType: 'module',
},
plugins: ['react', 'prettier', ... | 1,608 |
0 | petrpan-code/clintonwoo | petrpan-code/clintonwoo/hackernews-react-graphql/.prettierignore | .next
build
docs
public
| 1,609 |
0 | petrpan-code/clintonwoo | petrpan-code/clintonwoo/hackernews-react-graphql/Dockerfile | # DEV BUILD STEP
FROM node:14.17-alpine3.13 as devBuild
WORKDIR /app
# Log the npm config and env variables
ENV NODE_ENV=production
RUN npm config ls
RUN env
# Install dependencies first so docker caches them
COPY package.json package-lock.json /app/
RUN ls -a
RUN npm install --production=false
# Copy the source cod... | 1,610 |
0 | petrpan-code/clintonwoo | petrpan-code/clintonwoo/hackernews-react-graphql/LICENSE | The MIT License (MIT)
Copyright (c) 2017, Clinton D'Annolfo
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merg... | 1,611 |
0 | petrpan-code/clintonwoo | petrpan-code/clintonwoo/hackernews-react-graphql/README.md | <h2 align="center">Hacker News Clone React/GraphQL</h2>
<p align="center">
<a href="https://github.com/clintonwoo/hackernews-react-graphql/stargazers"><img alt="GitHub Stars" src="https://img.shields.io/github/stars/clintonwoo/hackernews-react-graphql.svg?style=social&label=Star"></a>
<a href="https://github.com/clin... | 1,612 |
0 | petrpan-code/clintonwoo | petrpan-code/clintonwoo/hackernews-react-graphql/babel.config.js | // Next.JS expects babel.config.js in app root, we want /pages in /src folder so we have it here
module.exports = (api) => {
api.cache(false);
return {
presets: ['next/babel'],
plugins: [],
};
};
| 1,613 |
0 | petrpan-code/clintonwoo | petrpan-code/clintonwoo/hackernews-react-graphql/healthcheck.js | // This file is used to run health checks with Node in the Docker container
var http = require('http');
var options = {
host: 'localhost',
port: '3000',
timeout: 2000,
};
var request = http.request(options, (res) => {
console.log(`STATUS: ${res.statusCode}`);
if (res.statusCode == 200) {
process.exi... | 1,614 |
0 | petrpan-code/clintonwoo | petrpan-code/clintonwoo/hackernews-react-graphql/jest-setup.js | // Fail tests on any warning
// console.error = (message) => {
// throw new Error(message);
// };
| 1,615 |
0 | petrpan-code/clintonwoo | petrpan-code/clintonwoo/hackernews-react-graphql/jest.config.js | module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
setupFilesAfterEnv: ['<rootDir>/jest-setup.js'],
transform: { '^.+\\.tsx?$': 'ts-jest' },
testMatch: ['**/__tests__/**/*.ts?(x)', '**/?(*.)+(spec).ts?(x)'],
verbose: true,
globals: {
'ts-jest': {
tsconfig: 'tsconfig-server.json',
... | 1,616 |
0 | petrpan-code/clintonwoo | petrpan-code/clintonwoo/hackernews-react-graphql/next-env.d.ts | /// <reference types="next" />
/// <reference types="next/image-types/global" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
| 1,617 |
0 | petrpan-code/clintonwoo | petrpan-code/clintonwoo/hackernews-react-graphql/next.config.js | module.exports = {
future: {
webpack5: true,
},
webpack: (config) => {
// Perform customizations to webpack config
return config;
},
};
| 1,618 |
0 | petrpan-code/clintonwoo | petrpan-code/clintonwoo/hackernews-react-graphql/nodemon.json | {
"watch": ["server"],
"exec": "ts-node --log-error --project tsconfig-server.json server/server.ts",
"ext": "js ts tsx"
}
| 1,619 |
0 | petrpan-code/clintonwoo | petrpan-code/clintonwoo/hackernews-react-graphql/package-lock.json | {
"name": "hackernews",
"version": "0.9.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "hackernews",
"version": "0.9.0",
"license": "Apache-2.0",
"dependencies": {
"@apollo/client": "3.5.7",
"@graphql-tools/utils": "8.6.1",
"apollo-s... | 1,620 |
0 | petrpan-code/clintonwoo | petrpan-code/clintonwoo/hackernews-react-graphql/package.json | {
"name": "hackernews",
"version": "0.9.0",
"description": "A hacker news clone built from the ground up to demonstrate React and GraphQL",
"engines": {
"node": ">=14.16.0"
},
"scripts": {
"clean": "rm -rf dist && rm -rf ./.next",
"build": "npm run clean && next build && tsc --project tsconfig-s... | 1,621 |
0 | petrpan-code/clintonwoo | petrpan-code/clintonwoo/hackernews-react-graphql/prettier.config.js | module.exports = {
singleQuote: true,
printWidth: 100,
};
| 1,622 |
0 | petrpan-code/clintonwoo | petrpan-code/clintonwoo/hackernews-react-graphql/tsconfig-server.json | {
"extends": "./tsconfig.json",
"compilerOptions": {
"jsx": "react",
"module": "commonjs",
"outDir": "dist",
"target": "es2017",
"isolatedModules": false,
"noEmit": false
},
"include": ["**/*.ts", "server/**/*.tsx"],
"exclude": ["node_modules", "**/__mocks__*", "**/__tests__*", "**/*.s... | 1,623 |
0 | petrpan-code/clintonwoo | petrpan-code/clintonwoo/hackernews-react-graphql/tsconfig.json | {
"compilerOptions": {
"allowJs": true,
"checkJs": false,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"jsx": "preserve",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"module": "esnext",
"moduleResolution": "node",
"noEmit": false,
"noImpl... | 1,624 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/docs/README.md | ### Directory Structure
*docs* - Contains extra documentation. | 1,625 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/pages/active.tsx | import * as React from 'react';
import { NewsFeedView } from '../src/components/news-feed';
import { sampleData } from '../src/data/sample-data';
import { withDataAndRouter } from '../src/helpers/with-data';
import { MainLayout } from '../src/layouts/main-layout';
export function ActivePage(props): JSX.Element {
co... | 1,626 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/pages/ask.tsx | import gql from 'graphql-tag';
import * as React from 'react';
import { useQuery } from '@apollo/client';
import { NewsFeed, newsFeedNewsItemFragment } from '../src/components/news-feed';
import { FeedType } from '../src/data/models';
import { withDataAndRouter } from '../src/helpers/with-data';
import { MainLayout } ... | 1,627 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/pages/best.tsx | import gql from 'graphql-tag';
import * as React from 'react';
import { useQuery } from '@apollo/client';
import { NewsFeed, newsFeedNewsItemFragment } from '../src/components/news-feed';
import { FeedType } from '../src/data/models';
import { withDataAndRouter } from '../src/helpers/with-data';
import { MainLayout } ... | 1,628 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/pages/bestcomments.tsx | import * as React from 'react';
import { NewsFeedView } from '../src/components/news-feed';
import { sampleData } from '../src/data/sample-data';
import { withDataAndRouter } from '../src/helpers/with-data';
import { MainLayout } from '../src/layouts/main-layout';
export function BestCommentsPage(props): JSX.Element ... | 1,629 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/pages/bookmarklet.tsx | import Link from 'next/link';
import * as React from 'react';
import { NoticeLayout } from '../src/layouts/notice-layout';
export function BookmarkletPage(props): JSX.Element {
return (
<NoticeLayout>
<b>Bookmarklet</b>
<br />
<br />
<div id="main">
<p id="first">
Thank... | 1,630 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/pages/changepw.tsx | import * as React from 'react';
import { withDataAndRouter } from '../src/helpers/with-data';
import { MainLayout } from '../src/layouts/main-layout';
export function ChangePasswordPage(props): JSX.Element {
const { router } = props;
return (
<MainLayout currentUrl={router.pathname}>
<h1>Change PW</h1>... | 1,631 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/pages/dmca.tsx | import Head from 'next/head';
import * as React from 'react';
import { BlankLayout } from '../src/layouts/blank-layout';
const spanStyle = { fontSize: '11.5pt', fontFamily: 'Helvetica', color: '#444444' };
const paragraphStyle = { marginBottom: '7.5pt', lineHeight: 'normal', background: 'white' };
const liStyle = {
... | 1,632 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/pages/favorites.tsx | import gql from 'graphql-tag';
import * as React from 'react';
import { useQuery } from '@apollo/client';
import { NewsFeed, newsFeedNewsItemFragment } from '../src/components/news-feed';
import { withDataAndRouter } from '../src/helpers/with-data';
import { MainLayout } from '../src/layouts/main-layout';
import { Fee... | 1,633 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/pages/forgot.tsx | import { NextRouter } from 'next/router';
import React, { useState } from 'react';
import { withDataAndRouter } from '../src/helpers/with-data';
import { BlankLayout } from '../src/layouts/blank-layout';
export interface IForgotPageProps {
router: NextRouter; // { how: UserLoginErrorCode }
}
function ForgotPage(pr... | 1,634 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/pages/formatdoc.tsx | import * as React from 'react';
import { MainLayout } from '../src/layouts/main-layout';
import { withDataAndRouter } from '../src/helpers/with-data';
export function FormatDocPage(props): JSX.Element {
const { router } = props;
return (
<MainLayout
isFooterVisible={false}
isNavVisible={false}
... | 1,635 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/pages/front.tsx | import * as React from 'react';
import { withDataAndRouter } from '../src/helpers/with-data';
import { MainLayout } from '../src/layouts/main-layout';
export function FrontPage(props): JSX.Element {
const { router } = props;
return (
<MainLayout currentUrl={router.pathname}>
<span>total</span>
</Mai... | 1,636 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/pages/hidden.tsx | import * as React from 'react';
import { NewsFeedView } from '../src/components/news-feed';
import { sampleData } from '../src/data/sample-data';
import { withDataAndRouter } from '../src/helpers/with-data';
import { MainLayout } from '../src/layouts/main-layout';
export function HiddenPage(props): JSX.Element {
co... | 1,637 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/pages/index.tsx | import gql from 'graphql-tag';
import * as React from 'react';
import { useQuery } from '@apollo/client';
import { NewsFeed, newsFeedNewsItemFragment } from '../src/components/news-feed';
import { withDataAndRouter } from '../src/helpers/with-data';
import { MainLayout } from '../src/layouts/main-layout';
import { Fee... | 1,638 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/pages/item.tsx | import gql from 'graphql-tag';
import * as React from 'react';
import { useQuery } from '@apollo/client';
import { commentsFragment } from '../src/components/comments';
import { newsDetailNewsItemFragment } from '../src/components/news-detail';
import { NewsItemWithComments } from '../src/components/news-item-with-com... | 1,639 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/pages/jobs.tsx | import { useQuery } from '@apollo/client';
import gql from 'graphql-tag';
import * as React from 'react';
import { NewsFeed, newsFeedNewsItemFragment } from '../src/components/news-feed';
import { withDataAndRouter } from '../src/helpers/with-data';
import { MainLayout } from '../src/layouts/main-layout';
import { Fee... | 1,640 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/pages/leaders.tsx | import * as React from 'react';
import { withDataAndRouter } from '../src/helpers/with-data';
import { MainLayout } from '../src/layouts/main-layout';
export function LeadersPage(props): JSX.Element {
const { router } = props;
return (
<MainLayout currentUrl={router.pathname}>
<span>total</span>
</... | 1,641 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/pages/lists.tsx | import Link from 'next/link';
import * as React from 'react';
import { withDataAndRouter } from '../src/helpers/with-data';
import { MainLayout } from '../src/layouts/main-layout';
export function ListsPage(props): JSX.Element {
const { router } = props;
return (
<MainLayout currentUrl={router.pathname}>
... | 1,642 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/pages/login.tsx | import { useQuery } from '@apollo/client';
import Link from 'next/link';
import Router, { NextRouter } from 'next/router';
import React, { useState } from 'react';
import { IMeQuery, ME_QUERY } from '../src/data/queries/me-query';
import { validateNewUser } from '../src/data/validation/user';
import {
getErrorMessag... | 1,643 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/pages/newcomments.tsx | import * as React from 'react';
import { NewsFeedView } from '../src/components/news-feed';
import { sampleData } from '../src/data/sample-data';
import { withDataAndRouter } from '../src/helpers/with-data';
import { MainLayout } from '../src/layouts/main-layout';
export function NewCommentsPage(props): JSX.Element {... | 1,644 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/pages/newest.tsx | import { useQuery } from '@apollo/client';
import gql from 'graphql-tag';
import * as React from 'react';
import { NewsFeed, newsFeedNewsItemFragment } from '../src/components/news-feed';
import { withDataAndRouter } from '../src/helpers/with-data';
import { MainLayout } from '../src/layouts/main-layout';
import { Fee... | 1,645 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/pages/newpoll.tsx | import * as React from 'react';
import { NewsFeedView } from '../src/components/news-feed';
import { sampleData } from '../src/data/sample-data';
import { withDataAndRouter } from '../src/helpers/with-data';
import { MainLayout } from '../src/layouts/main-layout';
export function NewPollPage(props): JSX.Element {
c... | 1,646 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/pages/newsfaq.tsx | import Link from 'next/link';
import * as React from 'react';
import { NoticeLayout } from '../src/layouts/notice-layout';
export function NewsFaqPage(): JSX.Element {
return (
<NoticeLayout>
<b>Hacker News FAQ</b>
<br />
<br />
<b>Are there rules about submissions and comments?</b>
... | 1,647 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/pages/newsguidelines.tsx | import Link from 'next/link';
import * as React from 'react';
import { NoticeLayout } from '../src/layouts/notice-layout';
export function NewsGuidelinesPage(): JSX.Element {
return (
<NoticeLayout>
<b>Hacker News Guidelines</b>
<br />
<br />
<b>What to Submit</b>
<p>
On-To... | 1,648 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/pages/newswelcome.tsx | import Link from 'next/link';
import * as React from 'react';
import { NoticeLayout } from '../src/layouts/notice-layout';
export function NewsWelcomePage(): JSX.Element {
return (
<NoticeLayout>
<b>Welcome to Hacker News</b>
<br />
<br />
<p>
<Link href="/">
<a>Hacker ... | 1,649 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/pages/noobcomments.tsx | import * as React from 'react';
import { NewsFeedView } from '../src/components/news-feed';
import { sampleData } from '../src/data/sample-data';
import { withDataAndRouter } from '../src/helpers/with-data';
import { MainLayout } from '../src/layouts/main-layout';
export function NoobCommentsPage(props): JSX.Element ... | 1,650 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/pages/noobstories.tsx | import * as React from 'react';
import { NewsFeedView } from '../src/components/news-feed';
import { sampleData } from '../src/data/sample-data';
import { withDataAndRouter } from '../src/helpers/with-data';
import { MainLayout } from '../src/layouts/main-layout';
export function NoobStoriesPage(props): JSX.Element {... | 1,651 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/pages/reply.tsx | import gql from 'graphql-tag';
import * as React from 'react';
import { useQuery } from '@apollo/client';
import { commentFragment } from '../src/components/comment';
import { withDataAndRouter } from '../src/helpers/with-data';
import { MainLayout } from '../src/layouts/main-layout';
const query = gql`
query Comme... | 1,652 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/pages/security.tsx | import Link from 'next/link';
import * as React from 'react';
import { NoticeLayout } from '../src/layouts/notice-layout';
export function SecurityPage(): JSX.Element {
return (
<NoticeLayout>
<b>Hacker News Security</b>
<p>
If you find a security hole, please let us know at{' '}
<a ... | 1,653 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/pages/show.tsx | import { useQuery } from '@apollo/client';
import gql from 'graphql-tag';
import Link from 'next/link';
import * as React from 'react';
import { NewsFeed, newsFeedNewsItemFragment } from '../src/components/news-feed';
import { withDataAndRouter } from '../src/helpers/with-data';
import { MainLayout } from '../src/layo... | 1,654 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/pages/showhn.tsx | import Link from 'next/link';
import * as React from 'react';
import { NoticeLayout } from '../src/layouts/notice-layout';
export function ShowHNRulesPage(): JSX.Element {
return (
<NoticeLayout>
<b>Show HN</b>
<br />
<br />
<p>Show HN is a way to share something that you've made on Hack... | 1,655 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/pages/shownew.tsx | import { useQuery } from '@apollo/client';
import gql from 'graphql-tag';
import Link from 'next/link';
import * as React from 'react';
import { NewsFeed, newsFeedNewsItemFragment } from '../src/components/news-feed';
import { POSTS_PER_PAGE } from '../src/config';
import { FeedType } from '../src/data/models';
import... | 1,656 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/pages/submit.tsx | import Link from 'next/link';
import Router from 'next/router';
import React, { useState } from 'react';
import { useMutation } from '@apollo/client';
import { SUBMIT_NEWS_ITEM_MUTATION } from '../src/data/mutations/submit-news-item-mutation';
import { withDataAndRouter } from '../src/helpers/with-data';
import { Main... | 1,657 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/pages/submitted.tsx | import * as React from 'react';
import { NewsFeedView } from '../src/components/news-feed';
import { sampleData } from '../src/data/sample-data';
import { withDataAndRouter } from '../src/helpers/with-data';
import { MainLayout } from '../src/layouts/main-layout';
export function SubmittedPage(props): JSX.Element {
... | 1,658 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/pages/threads.tsx | import * as React from 'react';
import { NewsFeedView } from '../src/components/news-feed';
import { sampleData } from '../src/data/sample-data';
import { withDataAndRouter } from '../src/helpers/with-data';
import { MainLayout } from '../src/layouts/main-layout';
export interface IThreadsPageProps {
router;
}
exp... | 1,659 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/pages/upvoted.tsx | import { useQuery } from '@apollo/client';
import gql from 'graphql-tag';
import * as React from 'react';
import { NewsFeed, newsFeedNewsItemFragment } from '../src/components/news-feed';
import { POSTS_PER_PAGE } from '../src/config';
import { FeedType } from '../src/data/models';
import { withDataAndRouter } from '.... | 1,660 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/pages/user.tsx | import { useQuery } from '@apollo/client';
import gql from 'graphql-tag';
import Link from 'next/link';
import * as React from 'react';
import renderHTML from 'react-render-html';
import { convertNumberToTimeAgo } from '../src/helpers/convert-number-to-time-ago';
import { withDataAndRouter } from '../src/helpers/with-... | 1,661 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/pages/x.tsx | import * as React from 'react';
import { useRouter } from 'next/router';
import { MainLayout } from '../src/layouts/main-layout';
import { withData } from '../src/helpers/with-data';
/** Password recovery email sent page after submitting forgot password */
function PasswordRecoveryPage(): JSX.Element {
const router... | 1,662 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/public/robots.txt | User-Agent: *
Disallow: / # Dont allow any pages to be indexed by robots for demo
| 1,663 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql/public | petrpan-code/clintonwoo/hackernews-react-graphql/public/static/README.md | This folder holds all of the static assets for build.
| 1,664 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql/public | petrpan-code/clintonwoo/hackernews-react-graphql/public/static/dmca.css | /* THIS CSS FILE DOES NOT EXIST ON THE REAL YCOMBINATOR BUT ONLY AS A SCRIPT TAG */
/* Font Definitions */
@font-face
{font-family:"Courier New";
panose-1:2 7 3 9 2 2 5 2 4 4;}
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;... | 1,665 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql/public | petrpan-code/clintonwoo/hackernews-react-graphql/public/static/news.css | body { font-family:Verdana, Geneva, sans-serif; font-size:10pt; color:#828282; }
td { font-family:Verdana, Geneva, sans-serif; font-size:10pt; color:#828282; }
.admin td { font-family:Verdana, Geneva, sans-serif; font-size:8.5pt; color:#000000; }
.subtext td { font-family:Verdana, Geneva, sans-serif; font-size: ... | 1,666 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql/public | petrpan-code/clintonwoo/hackernews-react-graphql/public/static/yc.css | body { font-family:Verdana; font-size:8.5pt; }
td { font-family:Verdana; font-size:8.5pt; line-height:138%; }
blockquote {line-height:122%; }
p { margin-bottom:15px; }
a:link { color:#222222; }
a:visited { color:#444444; }
b { color:#333333; }
.foot { font-size:7.5pt; }
.foot a:link, .foot a:visited { text-decorat... | 1,667 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/server/graphql-resolvers.spec.ts | import { sampleData } from '../src/data/sample-data';
import { resolvers } from './graphql-resolvers';
describe('graphql-resolvers', () => {
describe('Queries', () => {
it('returns expected data for query on Feed', () => {
expect(true);
});
it('returns expected data for query on Comment', () => {
... | 1,668 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/server/graphql-resolvers.ts | import { debug } from 'debug';
import { GraphQLScalarType } from 'graphql';
import { Kind } from 'graphql/language';
import type { IResolvers } from '@graphql-tools/utils';
import { NewsItemModel, CommentModel, UserModel } from '../src/data/models';
import type { CommentService } from './services/comment-service';
imp... | 1,669 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/server/graphql-schema.ts | import gql from 'graphql-tag';
/*
Schema properties are in following order:
Alphabetical
Resolved fields (requires extra db work)
Comments are provided when property is not obvious
*/
export const typeDefs = gql(`
type Comment {
id: Int!
creationTime: Date!
comments: [Comment]!
# The ... | 1,670 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/server/server.ts | import { ApolloServer } from 'apollo-server-express';
import { urlencoded } from 'body-parser';
import cookieParser from 'cookie-parser';
import express from 'express';
import session from 'express-session';
import { initializeApp } from 'firebase/app';
import { getDatabase, ref } from 'firebase/database';
import nextA... | 1,671 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql/server | petrpan-code/clintonwoo/hackernews-react-graphql/server/database/cache-warmer.ts | import { debug } from 'debug';
import { FeedType, NewsItemModel } from '../../src/data/models';
import type { FeedService } from '../services/feed-service';
import type { HnCache } from './cache';
import type { HnDatabase } from './database';
const logger = debug('app:cache-warmer');
logger.log = console.log.bind(con... | 1,672 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql/server | petrpan-code/clintonwoo/hackernews-react-graphql/server/database/cache.ts | import { debug } from 'debug';
import LRU from 'lru-cache';
import { NewsItemModel, UserModel, CommentModel, FeedType } from '../../src/data/models';
import { sampleData } from '../../src/data/sample-data';
const logger = debug('app:Cache');
logger.log = console.log.bind(console);
// The cache is a singleton
export... | 1,673 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql/server | petrpan-code/clintonwoo/hackernews-react-graphql/server/database/database.ts | import { debug } from 'debug';
import { child, get, DatabaseReference } from 'firebase/database';
import type { HnCache } from './cache';
import { CommentModel, FeedType, NewsItemModel, UserModel } from '../../src/data/models';
import { sampleData } from '../../src/data/sample-data';
import { HN_API_URL } from '../../... | 1,674 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql/server | petrpan-code/clintonwoo/hackernews-react-graphql/server/services/comment-service.spec.ts | import { CommentService } from './comment-service';
describe('NewsItem Model', () => {
it('gets a single comment', () => {
const id = 100;
const comment = CommentService.getComment(id);
expect(comment).toBeDefined();
});
it('gets an array of comments', () => {
const ids = [1, 3, 100];
const... | 1,675 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql/server | petrpan-code/clintonwoo/hackernews-react-graphql/server/services/comment-service.ts | import { debug } from 'debug';
import type { CommentModel } from '../../src/data/models';
import type { HnCache } from '../database/cache';
import type { HnDatabase } from '../database/database';
const logger = debug('app:Comment');
logger.log = console.log.bind(console);
export class CommentService {
db: HnDataba... | 1,676 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql/server | petrpan-code/clintonwoo/hackernews-react-graphql/server/services/feed-service.ts | import { debug } from 'debug';
import { FeedType, NewsItemModel } from '../../src/data/models';
import { sampleData } from '../../src/data/sample-data';
import { HnCache } from '../database/cache';
import { HnDatabase } from '../database/database';
const logger = debug('app:Feed');
logger.log = console.log.bind(conso... | 1,677 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql/server | petrpan-code/clintonwoo/hackernews-react-graphql/server/services/news-item-service.spec.ts | import { NewsItemService } from './news-item-service';
describe('NewsItem Model', () => {
it('gets a single News Item', () => {
const id = 1224;
const newsItem = NewsItemService.getNewsItem(id);
expect(newsItem).toBeDefined();
});
it('gets multiple News Items', () => {
const ids = [1224, 1225];... | 1,678 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql/server | petrpan-code/clintonwoo/hackernews-react-graphql/server/services/news-item-service.ts | import { debug } from 'debug';
import { NewsItemModel } from '../../src/data/models';
import { HnCache } from '../database/cache';
import { HnDatabase } from '../database/database';
const logger = debug('app:NewsItem');
logger.log = console.log.bind(console);
let newPostIdCounter = 100;
export class NewsItemService... | 1,679 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql/server | petrpan-code/clintonwoo/hackernews-react-graphql/server/services/user-service.ts | import { passwordIterations } from '../../src/config';
import { NewsItemModel, UserModel } from '../../src/data/models';
import { validateNewUser } from '../../src/data/validation/user';
import { createHash, createSalt } from '../../src/helpers/hash-password';
import type { HnCache } from '../database/cache';
import ty... | 1,680 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/src/README.md | ### Directory Structure
Nothing in this folder should import from the `pages` or `server` folder since code in here is intended to run on the client and server.
`src` - Source code
- `__tests__`: Jest tests colocated in each folder.
- `components`: React components with GraphQL fragments colocated in-file.
- `data`:... | 1,681 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql | petrpan-code/clintonwoo/hackernews-react-graphql/src/config.ts | /** True if the app is running on the server, false if running on the client */
export const IS_SERVER = typeof window === 'undefined';
/* SERVER CONFIG */
export const dev = process.env.NODE_ENV !== 'production';
export const appPath = process.env.NODE_ENV === 'production' ? './dist' : './src';
export const HN_DB_UR... | 1,682 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql/src | petrpan-code/clintonwoo/hackernews-react-graphql/src/@types/global.ts | export {};
| 1,683 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql/src | petrpan-code/clintonwoo/hackernews-react-graphql/src/__tests__/active.spec.tsx | /** @jest-environment jsdom */
import Page from '../../pages/active';
describe('Active Page', () => {
it('has default export', () => {
expect(Page).toBeDefined();
});
});
| 1,684 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql/src | petrpan-code/clintonwoo/hackernews-react-graphql/src/__tests__/ask.spec.tsx | /** @jest-environment jsdom */
import Page from '../../pages/ask';
describe('Newest Posts Page', () => {
it('has default export', () => {
expect(Page).toBeDefined();
});
});
| 1,685 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql/src | petrpan-code/clintonwoo/hackernews-react-graphql/src/__tests__/best.spec.tsx | /** @jest-environment jsdom */
import Page from '../../pages/best';
describe('Best Posts Page', () => {
it('has default export', () => {
expect(Page).toBeDefined();
});
});
| 1,686 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql/src | petrpan-code/clintonwoo/hackernews-react-graphql/src/__tests__/bestcomments.spec.tsx | /** @jest-environment jsdom */
import Page from '../../pages/bestcomments';
describe('Best Comments Page', () => {
it('has default export', () => {
expect(Page).toBeDefined();
});
});
| 1,687 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql/src | petrpan-code/clintonwoo/hackernews-react-graphql/src/__tests__/bookmarklet.spec.tsx | /** @jest-environment jsdom */
import Page from '../../pages/bookmarklet';
describe('Bookmarklet Page', () => {
it('has default export', () => {
expect(Page).toBeDefined();
});
});
| 1,688 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql/src | petrpan-code/clintonwoo/hackernews-react-graphql/src/__tests__/changepw.spec.tsx | /** @jest-environment jsdom */
import Page from '../../pages/changepw';
describe('Change Password Page', () => {
it('has default export', () => {
expect(Page).toBeDefined();
});
});
| 1,689 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql/src | petrpan-code/clintonwoo/hackernews-react-graphql/src/__tests__/dmca.spec.tsx | /** @jest-environment jsdom */
import Page from '../../pages/dmca';
describe('DMCA Page', () => {
it('has default export', () => {
expect(Page).toBeDefined();
});
});
| 1,690 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql/src | petrpan-code/clintonwoo/hackernews-react-graphql/src/__tests__/formatdoc.spec.tsx | /** @jest-environment jsdom */
import Page from '../../pages/formatdoc';
describe('Format Doc Page', () => {
it('has default export', () => {
expect(Page).toBeDefined();
});
});
| 1,691 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql/src | petrpan-code/clintonwoo/hackernews-react-graphql/src/__tests__/front.spec.tsx | /** @jest-environment jsdom */
import Page from '../../pages/front';
describe('Front Page', () => {
it('has default export', () => {
expect(Page).toBeDefined();
});
});
| 1,692 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql/src | petrpan-code/clintonwoo/hackernews-react-graphql/src/__tests__/hidden.spec.tsx | /** @jest-environment jsdom */
import Page from '../../pages/hidden';
describe('Hidden Posts Page', () => {
it('has default export', () => {
expect(Page).toBeDefined();
});
});
| 1,693 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql/src | petrpan-code/clintonwoo/hackernews-react-graphql/src/__tests__/index.spec.tsx | /** @jest-environment jsdom */
import Page from '../../pages/index';
describe('Home Page', () => {
it('has default export', () => {
expect(Page).toBeDefined();
});
});
| 1,694 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql/src | petrpan-code/clintonwoo/hackernews-react-graphql/src/__tests__/item.spec.tsx | /** @jest-environment jsdom */
import Page from '../../pages/item';
describe('News Item Page', () => {
it('has default export', () => {
expect(Page).toBeDefined();
});
});
| 1,695 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql/src | petrpan-code/clintonwoo/hackernews-react-graphql/src/__tests__/jobs.spec.tsx | /** @jest-environment jsdom */
import Page from '../../pages/jobs';
describe('Jobs Page', () => {
it('has default export', () => {
expect(Page).toBeDefined();
});
});
| 1,696 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql/src | petrpan-code/clintonwoo/hackernews-react-graphql/src/__tests__/leaders.spec.tsx | /** @jest-environment jsdom */
import Page from '../../pages/leaders';
describe('Leaders Page', () => {
it('has default export', () => {
expect(Page).toBeDefined();
});
});
| 1,697 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql/src | petrpan-code/clintonwoo/hackernews-react-graphql/src/__tests__/lists.spec.tsx | /** @jest-environment jsdom */
import Page from '../../pages/lists';
describe('Lists Page', () => {
it('has default export', () => {
expect(Page).toBeDefined();
});
});
| 1,698 |
0 | petrpan-code/clintonwoo/hackernews-react-graphql/src | petrpan-code/clintonwoo/hackernews-react-graphql/src/__tests__/login.spec.tsx | /** @jest-environment jsdom */
import Page from '../../pages/login';
describe('Login Page', () => {
it('has default export', () => {
expect(Page).toBeDefined();
});
});
| 1,699 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.