Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cpany/app

Package Overview
Dependencies
Maintainers
1
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cpany/app - npm Package Compare versions

Comparing version 0.0.57 to 0.0.58

dist/assets/About.40432dbf.js

6

package.json
{
"name": "@cpany/app",
"version": "0.0.57",
"version": "0.0.58",
"description": "CPany web app",

@@ -12,4 +12,4 @@ "repository": {

"dependencies": {
"@cpany/compress": "0.0.57",
"@cpany/types": "0.0.57",
"@cpany/compress": "0.0.58",
"@cpany/types": "0.0.58",
"tippy.js": "^6.3.1",

@@ -16,0 +16,0 @@ "vue": "^3.2.12",

@@ -72,10 +72,11 @@ import {

const cache = !!props.cache ? sortCache.get(props.cache) : undefined;
const isPagination = computed(() => isDef(realPageSize.value));
const { current, pageLength, L, R, nextPage, prePage, goPage } = usePagination(
realPageSize,
data
data,
props.cache
);
const cache = !!props.cache ? sortCache.get(props.cache) : undefined;
// sort

@@ -82,0 +83,0 @@ const sortField = ref(cache?.field ?? defaultSort.value);

@@ -1,2 +0,2 @@

import { ref, computed, Ref, unref } from 'vue';
import { ref, Ref, unref, computed, watch } from 'vue';

@@ -17,3 +17,9 @@ type MaybeRef<T> = Ref<T> | T;

export function usePagination(_pageSize: Ref<number | undefined>, data: MaybeRef<any[]>) {
const pageCache = new Map<string, number>();
export function usePagination(
_pageSize: Ref<number | undefined>,
data: MaybeRef<any[]>,
key?: string
) {
const dataLength = computed(() => unref(data).length);

@@ -23,6 +29,12 @@ const pageSize = computed(() => Math.max(1, unref(_pageSize) ?? dataLength.value));

const pageLength = computed(() => Math.ceil(dataLength.value / pageSize.value));
const current = ref(0);
const current = ref(key ? pageCache.get(key) ?? 0 : 0);
const L = computed(() => current.value * pageSize.value);
const R = computed(() => Math.min(dataLength.value, L.value + pageSize.value));
watch(current, (current: number) => {
if (key) {
pageCache.set(key, current);
}
});
const hasNextPage = computed(

@@ -29,0 +41,0 @@ () => current.value + 1 < pageLength.value && R.value < dataLength.value

@@ -79,7 +79,20 @@ import { createRouter, createWebHistory } from 'vue-router';

routes.push({
path: '/contest/:platform/:id',
name: 'EmptyContest',
component: () => import('./pages/Contest/Empty.vue'),
meta: {
title: '错误 - CPany'
}
});
export const router = createRouter({
history: createWebHistory(),
routes,
scrollBehavior() {
return { top: 0 };
scrollBehavior(to, from, savedPosition) {
if (savedPosition) {
return savedPosition;
} else {
return { top: 0 };
}
}

@@ -86,0 +99,0 @@ });

@@ -58,2 +58,21 @@ import { Ref, ref, unref } from 'vue';

export const displayPlatform = (type: string) => {
const wrapper = { type };
if (isCodeforces(wrapper)) {
return 'Codeforces';
} else if (isNowCoder(wrapper)) {
return '牛客竞赛';
} else if (isHdu(wrapper)) {
return 'HDu';
} else if (isLuogu(wrapper)) {
return '洛谷';
} else if (isPintia(wrapper)) {
return '拼题A';
} else if (isAtCoder(wrapper)) {
return 'AtCoder';
} else {
return type.charAt(0).toUpperCase() + type.slice(1);
}
};
export const displayContestType = (contest: IContest) => {

@@ -85,16 +104,3 @@ if (isCodeforces(contest)) {

export const displayProblemType = (problem: IProblem) => {
if (isCodeforces(problem)) {
return 'Codeforces';
} else if (isNowCoder(problem)) {
return '牛客竞赛';
} else if (isHdu(problem)) {
return 'HDu';
} else if (isLuogu(problem)) {
return '洛谷';
} else if (isAtCoder(problem)) {
return 'AtCoder';
} else {
const type = problem.type;
return type.charAt(0).toUpperCase() + type.slice(1);
}
return displayPlatform(problem.type);
};

@@ -101,0 +107,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc