mirror of
https://github.com/urbit/shrub.git
synced 2024-12-20 01:01:37 +03:00
webterm: small cleanup, comments
Also includes a more-sane prompt() description.
This commit is contained in:
parent
586c2da857
commit
0d2c135959
@ -191,7 +191,7 @@ export default function Buffer({ name, selected, dark }: BufferProps) {
|
|||||||
console.log(`subscription error, id ${id}:`, e);
|
console.log(`subscription error, id ${id}:`, e);
|
||||||
},
|
},
|
||||||
quit: async () => { // quit
|
quit: async () => { // quit
|
||||||
console.error('oops quit, reconnecting...');
|
console.error('quit, reconnecting...');
|
||||||
try {
|
try {
|
||||||
const newSubscriptionId = await retry(initSubscription, () => {
|
const newSubscriptionId = await retry(initSubscription, () => {
|
||||||
console.log('attempting to reconnect ...');
|
console.log('attempting to reconnect ...');
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
export const DEFAULT_SESSION = '';
|
export const DEFAULT_SESSION = '';
|
||||||
|
export const DEFAULT_HANDLER = 'hood';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Session ID validity:
|
* Session ID validity:
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
import { AGENT_SESSION_REGEX, SESSION_ID_REGEX } from '../constants';
|
import {
|
||||||
|
DEFAULT_HANDLER,
|
||||||
|
AGENT_SESSION_REGEX,
|
||||||
|
SESSION_ID_REGEX
|
||||||
|
} from '../constants';
|
||||||
import useTermState from '../state';
|
import useTermState from '../state';
|
||||||
import api from '../api';
|
import api from '../api';
|
||||||
import { pokeTask } from '@urbit/api/term';
|
import { pokeTask } from '@urbit/api/term';
|
||||||
@ -8,10 +12,10 @@ export const useAddSession = () => {
|
|||||||
const { names } = useTermState();
|
const { names } = useTermState();
|
||||||
|
|
||||||
const addSession = useCallback(async () => {
|
const addSession = useCallback(async () => {
|
||||||
let agent = 'hood'; // default agent
|
let agent = DEFAULT_HANDLER;
|
||||||
let sessionName: string;
|
let sessionName: string;
|
||||||
|
|
||||||
const userInput = prompt('please entew a session name uwu');
|
const userInput = prompt('Please enter an alpha-numeric session name.');
|
||||||
// user canceled or did not enter a value
|
// user canceled or did not enter a value
|
||||||
if (!userInput) {
|
if (!userInput) {
|
||||||
return;
|
return;
|
||||||
@ -42,6 +46,7 @@ export const useAddSession = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
//TODO eventually, customizable app pre-linking?
|
||||||
await api.poke(pokeTask(sessionName, { open: { term: agent, apps: [{ who: '~' + (window as any).ship, app: 'dojo' }] } }));
|
await api.poke(pokeTask(sessionName, { open: { term: agent, apps: [{ who: '~' + (window as any).ship, app: 'dojo' }] } }));
|
||||||
useTermState.getState().set((state) => {
|
useTermState.getState().set((state) => {
|
||||||
state.names = [sessionName, ...state.names].sort();
|
state.names = [sessionName, ...state.names].sort();
|
||||||
|
Loading…
Reference in New Issue
Block a user