1
Fork 0
mirror of https://github.com/diced/zipline.git synced 2025-04-04 23:21:17 -05:00

feat: save showNonMedia checkbox value

This commit is contained in:
diced 2022-12-08 18:50:00 -08:00
parent 4c633eb60d
commit 2c07d6719e
No known key found for this signature in database
GPG key ID: 370BD1BA142842D1
3 changed files with 9 additions and 6 deletions

View file

@ -3,10 +3,12 @@ import File from 'components/File';
import { FileIcon } from 'components/icons';
import MutedText from 'components/MutedText';
import { usePaginatedFiles } from 'lib/queries/files';
import { showNonMediaSelector } from 'lib/recoil/settings';
import { useState } from 'react';
import { useRecoilState } from 'recoil';
export default function FilePagation({ disableMediaPreview, exifEnabled }) {
const [checked, setChecked] = useState(false);
const [checked, setChecked] = useRecoilState(showNonMediaSelector);
const pages = usePaginatedFiles(!checked ? { filter: 'media' } : {});
const [page, setPage] = useState(1);

View file

@ -26,7 +26,7 @@ export const settingsState = atom<Settings>({
});
export const showNonMediaSelector = selector<boolean>({
key: 'settingsState',
key: 'settingsShowNonMediaSelector',
get: ({ get }) => get(settingsState).showNonMedia,
set: ({ set }, newValue) => set(settingsState, { showNonMedia: newValue }),
});

View file

@ -71,7 +71,7 @@ async function start() {
});
server.addHook('onResponse', (req, reply, done) => {
if (config.core.logger || dev || process.env.DEBUG) {
if (config.core.logger) {
if (req.url.startsWith('/_next')) return done();
server.logger.child('response').info(`${req.method} ${req.url} -> ${reply.statusCode}`);
@ -151,6 +151,7 @@ async function start() {
server.get('/r/:id', rawRoute.bind(server));
server.get('/', (_, reply) => reply.redirect('/dashboard'));
// initialize next routes after all other routes have been registered so theres no overlap
server.after(() => {
// overrides fastify's default parser so that next.js can handle the request
// in the future Zipline's api will probably be entirely handled by fastify
@ -166,9 +167,9 @@ async function start() {
server.next('/api/*', { method: 'ALL' });
});
server.setDefaultRoute((req, res) => {
server.nextHandle(req, res);
});
// server.setDefaultRoute((req, res) => {
// server.nextHandle(req, res);
// });
await server.listen({
port: config.core.port,